资 源 简 介
FilterQ alleviates the pain of using multiple if-else(..) checks when iterating over a collection to obtain a smaller view of that collection.
FilterQ uses an EDSL for filtering iterable objects.
Usage Sample
import static com.gotobject.filter.FilterQ.*;
final Iterable a = Arrays.asList(1, 2, 3, 40, 20, 30, 100);
final Iterable b = from(a).where(gt(20).and(lt(100))).skip(1);
// result (30)
What we are writing here to FilterQ is to give me all of the elements from a that are greater than 20 and less than 100, but please, when returning the filtered iterable, skip the first element of the filtered iterable.
Another Usage Sample
import static com.gotobject.filter.FilterQ.*;
final Integer[] numbers = {5, 4, 1, 3, 9, 8, 6, 7, 2, 0};
final String[] strings = {"zero","one","two","three","four","five","six","seven","eight