Antwort
Nach einer kurzen Google-Runde habe ich das auf Stackoverflow gefunden und ein bisschen für dich modifiziert. Das sortiert eine Map nach der Value - aber rückwärts
public static <K,V extends Comparable<? super V>> Map<K, V> entriesSortedByValues(Map<K,V> map) {
SortedSet<Map.Entry<K,V>> sortedEntries = new TreeSet<>((e1, e2) -> e2.getValue().compareTo(e1.getValue()));
sortedEntries.addAll(map.entrySet());
Map<K,V> sortedMap = new LinkedHashMap<>();
for (Map.Entry<K,V> entry : sortedEntries)
sortedMap.put(entry.getKey(), entry.getValue());
return sortedMap;
}