Skip to content

Instantly share code, notes, and snippets.

@codeaholicguy
Last active December 19, 2015 16:54
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 codeaholicguy/281328fe874e857d1fa5 to your computer and use it in GitHub Desktop.
Save codeaholicguy/281328fe874e857d1fa5 to your computer and use it in GitHub Desktop.
Optional<Integer> minAge = person
.stream()
.map(p -> p.getAge()) // return Stream<Integer>
.filter(age -> age > 20) // return Stream<Integer>
.min(Comparator.naturalOrder()); // terminal operation
people.stream()
.map(p -> p.getLastname())
.allMatch(length < 10); // terminal operation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment