Hello please help me with this code
here wordcnt is a hashtable
}//for words that are repeated more than once
}//word that is first appeared
The problem here is that if the word appeared for more than once its got replaced by 2nd one ...
If I want to have both the first and next appeared words what I can do?
If you want to store Object instances with String keys and
want to save all appearances of the key chronologically you can use
HashMap<String, ArrayList<Object>> map = new HashMap<String, ArrayList<Object>>();
//A word is found and assigned to the variable 'key',
//the value to store is assigned to 'value'.
ArrayList<Object> list = map.get(key); //null if it does not exist yes
if (list == null)
list = new ArrayList<Object>();