public List < T > descendingKeys ( ) { List < T > list = new ArrayList < T > ( map . keySet ( ) ) ; sort ( list , new Comparator < T > ( ) { @ Override public int compare ( T o1 , T o2 ) { MutableLong l1 = map . get ( o1 ) ; MutableLong l2 = map . get ( o2 ) ; return compare ( l2 . value , l1 . value ) ; } private int compare ( long x , long y ) { return ( x < y ) ? - 1 : ( ( x == y ) ? 0 : 1 ) ; } } ) ; return list ; }
Returns a List of keys in descending value order .