在实际中经常用到对
List
Collections.sort(wordMap, new Comparator
public int compare(Map.Entry
Map.Entry
double result = o2.getValue() - o1.getValue();
if(result > 0)
return 1;
else if(result == 0)
return 0;
else
return -1;
}
});
推荐阅读: