You can try out my library CollectionsQuery. It allows to run LINQ like queries over collections of objects.
You have to pass predicate, just like in LINQ. If you are using java6/7 than you have to use old syntax with Interfaces:
List names = Queryable.from(people)
.filter(new Predicate() {
public boolean filter(Person p) {
return p.age>20;
}
})
.map (new Converter() {
public Integer convert(Person p) {
return p.name;
}
})
.toList();
You can also use it in Java8, or in old java with RetroLambda and it's gradle plugin, then you will have new fancy syntax:
List names = Queryable.from(people)
.filter(p->p.age>20)
.map (p->p.name)
.toList();
If you need to run DB queryes, than you can look on JINQ, as mentioned above, but it can't be back-ported by RetroLambda, doe to use of serialized lambdas.