I have a treemap containing occurrence of words like this …
TreeMap <String,Integer> occurrence = new TreeMap <String,Integer>();
String = Word
Integer = amount of occurrence.
How would I get the maximum occurrence – integer and then get the String mapped to the highest occurrence?
You’d have to iterate through the map and search for it linearly. The
TreeMapis sorted on the keys, not the values.