I'm using streamreader now to read a file of people names, it is a text file, of people first names, so there are obviously duplicates, and i want to be able to display how many people have the same now so for example:
josh
alex
josh
john
alex
I want it to say,
josh 2
alex 2
john 1
but I can't seem to find an easy way of doing this, what would be the easiest way about doing this,
Using an HashMap is a solution to your problem. When you read a name, check if the key is already present, if so, update it (+1), if not add it to your Hash Map.
In the end, all you need to do is print the key-value pairs.