Affects Version/s: None
Fix Version/s: None
In my current project I created a set of new Predicates that I call as Property Predicates. These predicates can used to filter a collection based on property values.
For example we have :
Collection<Foo> myFoos ;
And we want to find all the Foo in myFoos with name that starts with A, and age > 40 and who are living at Zip 07095 we can create a Predicate like follows:
Predicate p = new PropertyLikePredicate("name","A*")
Note: Like supports wildcards '*' and '?'
What is even better is that these predicates work with collections too. What I mean is if we have :
And you want to locate someone with a zip 07095 as part of anyof its' addresses all we need is to create a predicate :
Predicate p = new PropertyEqualsPredicate("addresses.zip","07095");
My Predicate chain currently supports the following features:
All features have accompanying testcases. In my opinion this is a powerful addition to the functors and I would like to contribute this work to the commons-collection.