I have a HashMap
defined like this...
HashMap<String,Integer> uniqueNames = new HashMap<String,Integer>();
It stores a name, and the occurence of that name. For example...
uniqueNames.put("lastname",42);
How can I get the name with the highest occurrence?
For some more information, I'm working with a binary search tree of "people", storing the unique names and frequencies in a HashMap
. What I want to do is to print the most common last names, and someone told me to use HashMap
as I wanted to store a String
together with an Integer
. Maybe I should use a class to store the name and frequency instead? Could someone please offer some suggestions.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…