Here you can find the source of sortByDescendingOrder(Map
public static <T> List<Map.Entry<T, Double>> sortByDescendingOrder(Map<T, Double> collection)
//package com.java2s; //License from project: Apache License import java.util.*; public class Main { public static <T> List<Map.Entry<T, Double>> sortByDescendingOrder(Map<T, Double> collection) { List<Map.Entry<T, Double>> list = new ArrayList<Map.Entry<T, Double>>(collection.entrySet()); Collections.sort(list, new Comparator<Map.Entry<T, Double>>() { public int compare(Map.Entry<T, Double> o1, Map.Entry<T, Double> o2) { if (o1.getValue() > o2.getValue()) { return -1; } else if (o1.getValue() < o2.getValue()) { return 1; } else { return 0; }//from www .j av a2 s . c om } }); return list; } }