I want to sort android wifi ScanResult objects by BSSID levels. What would be the most efficient way to do that? Do I have to create my own Comparable ScanResult and write code to convert to/from ScanResult?
Creating your own Comparator
will probably be more straightforward. Assuming you have some sort of Collection containing the ScanResults (list
in the example below):
Collections.sort(list, new Comparator<ScanResult>() {
@Override public int compare(ScanResult lhs, ScanResult rhs) {
// add your sorting logic
}
});