Skip to content

Instantly share code, notes, and snippets.

@exhesham
Created April 16, 2018 05:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save exhesham/84a2ba9f3851da5821dae4f27bbb89cb to your computer and use it in GitHub Desktop.
Save exhesham/84a2ba9f3851da5821dae4f27bbb89cb to your computer and use it in GitHub Desktop.
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