Skip to content

Instantly share code, notes, and snippets.

@exhesham
Created April 16, 2018 05:46
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/6e32c0cd7d4d8e94743f4785f0e4a68a to your computer and use it in GitHub Desktop.
Save exhesham/6e32c0cd7d4d8e94743f4785f0e4a68a to your computer and use it in GitHub Desktop.
Function<String, Predicate<Ticket>> ticketFor = event -> ticket -> event.equals(ticket.getName());
List<Ticket> tickets = getAllTickets();
Integer soldTicketsForCoolEvent = tickets.stream()
.filter(ticketFor.apply("CoolEvent")).count();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment