I am trying to figure out how could I get the top 10 values from the HashMap
. I was initially trying to use the TreeMap
and have it sort by value and then take the first 10 values however it seems that that is not the option, as TreeMap
sorts by key.
I want to still be able to know which keys have the highest values, the K, V
of the map are String, Integer
.