0
How to sort values in a HashMap on basis of values and not on Keys?
3 ответов
0
In java 8
Map<Integer, String> sortedMap = unsortedMap.entrySet().stream() .sorted(Entry.comparingByValue()) .collect(Collectors.toMap(Entry::getKey, Entry::getValue, (e1, e2) -> e1, LinkedHashMap::new));
0
will this work ? i mean what is unsortedMap? is it an object?
0
yes, it is unsorted map object.