-
Notifications
You must be signed in to change notification settings - Fork 0
Home
ohadlights edited this page Sep 17, 2015
·
4 revisions
Welcome to the JQueryable wiki! Here are some snippets...
A complete sample can be found in the repository in the samples project.
private final QueryableList<FruitProduct> fruits = Queryable.newQueryableList();
@Override
public IQueryable<Apple> getApples() {
return this.fruits.filter(f -> f instanceof Apple).map(f -> (Apple)f);
}
Optional<Orange> orange = store.getOranges().sorted(getComparator()).findFirst();
if (orange.isPresent()) {
System.out.println("The cheap client bought an " + orange.get().toString());
store.buyOrange(orange.get());
}
if (store.getFruits().anyMatch(f -> f.getWeight() > 0.4)) {
System.out.println("The curious client found fruits that weigh more than 0.4");
}