Answers for "sort a list according to location"

0

sort a list according to location

LonLat myHouse = /* whatever */ ;
Comparable comp = new Comparable () {
    LonLat a;
    int compareTo (Object b) {
        int aDist = calcDistance(a, myHouse) ;
        int bDist = calcDistance(b, myHouse) ;
        return aDist - bDist;
    }
};
myLonLatList.sort(lonLatList, comp);
Posted by: Guest on December-10-2020

Code answers related to "sort a list according to location"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language