Let us assume I have the following list .
List<String> list=new ArrayList<String>();
list.add("sultan");
list.add("Masum");
list.add("sultan");
list.add("Sorry");
list.add("sultan");
list.add("Masum");
list.add("sultan");
list.add("Tarek");
list.add("sultan");
I want to know the count of occurrence of each string in Arraylist
. How can I do that ? And I also want to know the string that is occurred in this Arraylist
at highest times. For this particular example, the answer is "Sultan" .