List<Map.Entry<Integer,Integer>>list = map.entrySet().stream()
.sorted((entry1, entry2) -> entry1.getValue().compareTo(entry2.getValue()))
.collect(Collectors.toList());
It is assumed that the value type is Integer, and other types are similar