value기준 오름차순 정렬
HashMap<String, Integer> map = new HashMap<>();
map.put("a", 110);
map.put("b", 109);
map.put("c", 108);
map.put("d", 107);
map.put("e", 106);
List<Map.Entry<String, Integer>> entryList = new ArrayList<>(map.entrySet());
System.out.println(entryList);
Collections.sort(entryList, (o1, o2) -> {
return o1.getValue().compareTo(o2.getValue());
});
System.out.println(entryList);
LinkedHashMap<String, Integer> sortedMap = new LinkedHashMap<>();
for (Map.Entry<String, Integer> entry : entryList) {
sortedMap.put(entry.getKey(), entry.getValue());
}
System.out.println("sortedMap : " + sortedMap);