Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Predicate<Person> isAnAdult = person -> person.getAge() >= 18;
List<Person> people = getAllPeople();
Integer nrOfAdults = people.stream() .filter(isAnAdult).count();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment