Map<String, Long> energyMap= new TreeMap<String, Long>();
List<Map.Entry<String, Double>> energyMapList = new ArrayList<Map.Entry<String, Double>>(energyMap.entrySet());
Collections.sort(energyMapList, new Comparator<Map.Entry<String, Double>>() {
@Override
public int compare(Map.Entry<String, Double> o1, Map.Entry<String, Double> o2) {
return o2.getValue().compareTo(o1.getValue());
}
});
网友评论