I have list List where Custom is like
List
Custom
class Custom{ public int id; public String name; }
How to
This can now be done easily with Java 8 streams — no extra libraries required.
List list = /*...*/; long numMatches = list.stream() .filter(c -> "Tom".equals(c.name)) .count();