Obtenga las 3 entradas principales basadas en valores map java

//Get top 3 entries of a map, compared by value
Map<String,Integer> mapWithTop3Entries = hm.entrySet().stream().sorted(Map.Entry.<String, Integer>comparingByValue().reversed()).limit(3).collect(Collectors.toMap(Map.Entry::getKey,Map.Entry::getValue));
#KMJ