I am looking for a library which can select object from ArrayList like SQL \"where\" command.
I have huge arraylists (between 2000 and 20000) in my project and i don\'t
The Guava library is much more popular than lambdaj, and does allow you to avoid for, while loops by using preficates and filter methods.
If you can use xpresso, you can write:
list<Sale> sortedSales = x.list(x.sorted(sales, x.invoke("getCost")));
(I am the author of xpresso)
If you want to select an element that matches a criteria (or elementS that will match), use the Java 8 filter function. (no need to use other libraries anymore).
Do it as:
List<Foo> listOfFoo = ...
Stream<Foo> matchingFoo = listOfFoo.stream().filter(t -> t.propertyOrMethod == 'criteria');