I have list List where Custom is like
class Custom{
public int id;
public String name;
}
How to
Either you keep track as you add or remove items from the list. This could take the place of a hashmap Name->Count . Where when you add an item you increment the count for that name, and when you remove it you decrement the count.
Or you iterate over the collection with a loop checking for the name in question.
Depending on the behavior of your application one of these methods will be faster but without more information it is hard to tell which.