Assume I have a List the following values
emp1, emp2, emp3, emp2, emp1, emp4, emp1
I need to get the number of times a string is repeated such as the following
emp1 - 3 times
emp2 - 2 times
emp3 - 1 times
emp4 - 1 times
I am trying to implement this by using map. Is this the correct way or is there any better way?