I am having trouble finding the most and least common name in an ArrayList. The formula should go through a file of names and count how many common names there are in the list then print the least and most common of them. I already have the most ArrayList Part finished, it is just finding the most and least common name I am having trouble with.I have no idea how to even start it.I have tried to look online but couldn't find any. I kind of tried to figure it out but this is all I could think of is using .equals.
for (int i = 0; i< dogs.size(); i++)
if dogs.get(0).getName().equals dogs.get(i).getName();
{
}