cho*_*hop 0 performance android comparable android-wifi
我想按BSSID级别对android wifi ScanResult对象进行排序.最有效的方法是什么?我是否必须创建自己的Comparable ScanResult并编写代码以转换为ScanResult或从ScanResult转换?
创建自己的Comparator可能会更直接.假设您有某种包含ScanResults的Collection(list在下面的示例中):
Collections.sort(list, new Comparator<ScanResult>() {
@Override public int compare(ScanResult lhs, ScanResult rhs) {
// add your sorting logic
}
});
Run Code Online (Sandbox Code Playgroud)