I want to rank in java an ArrayList<String>
with the number of times that the String appears.
Like this: if I have an
ArrayList<String>= [French, English, German, French, French, Belgium, English, Belgium]
I count the number that "French", "English", "Belgium",etc.
appear. So French appear 3 times, English 2 times, Belgium 2 times, German one times. Then I want to rank the ArrayList<String>
in function of the number.
The result will be:
French 3
English 2
Belgium 2
German 1
How I can do this? How to associate an integer and a String?