private void printResult() {
List
<Map
.Entry
<String, Integer>> wordsList
= new ArrayList<Map
.Entry
<String, Integer>>(wordsMap
.entrySet());
wordsList
.sort(new Comparator<Map
.Entry
<String, Integer>>() {
@Override
public int compare(Map
.Entry
<String, Integer> o1
, Map
.Entry
<String, Integer> o2
) {
return o2
.getValue().compareTo(o1
.getValue());
}
});
System
.out
.println(wordsList
.toString());
}
转载请注明原文地址:https://ipadbbs.8miu.com/read-18390.html