In a Java program, I have a list of beans that I want to filter based on a specific property.
For example, say I have a list of Person, a JavaBean, where Person has
With Java8 style you can use stream + filter to achieve your goal.
persons.stream() .filter(p -> names.contains(p.getName())) .collect(Collectors.toList());