Skip to content

Instantly share code, notes, and snippets.

@hasalex
Created September 24, 2017 17:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save hasalex/1b4e94a47f1dce6ae1b7c97bda34b824 to your computer and use it in GitHub Desktop.
Save hasalex/1b4e94a47f1dce6ae1b7c97bda34b824 to your computer and use it in GitHub Desktop.
persons.stream()
.filter(Person::isMale)
.filter(p -> p.isAdult(LocalDate.now()))
.map(p -> p.getFirstName() + " " + p.getLastName())
.collect(Collectors.toList());
@farnulfo
Copy link

Same "now" for everyone :-)

LocalDate now = LocalDate.now();
persons.stream()
.filter(Person::isMale)
.filter(p -> p.isAdult(now)
....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment