I need a data structure in Java that can manipulate Strings, compute the frequency of each word in an ArrayList<String> and then I need to sort them based on the frequencies.
To put it simply, the data structure needs to be an associative array, that can be sorted BY VALUES , I already put the lines into the HashMap and got surprised by the fact that it can't be sorted , now I'm stuck thinking about another data structure.
P.S. (using two lists is not suited to my program because it needs to do a lot of calculations, so it would be better if a single structure holds each String and its occurence instead of a list for the Strings and annother for the frequency).
EDIT: I appreciate the help, but some people are suggesting a TreeMap, so I want to specify something here: I need the structure sorted by the occurences of the strings (in the case of Maps it would be the values not the keys).
 
     
     
     
     
    