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
If you use a LinkedList(or any other collection which remove oprations is not very laborious) in single-threaded application the most efficacious solution is:
final Iterator userIterator = users.iterator();
while (userIterator.hasNext()) {
if (/* your condition for exclusion */) {
userIterator.remove();
}
}