Skip to content

Instantly share code, notes, and snippets.

  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save benweidig/17cf23ea515041b23ef3a153b43de24e to your computer and use it in GitHub Desktop.
List<Customer> customers = ...;
// Lambdas
customers.stream()
.filter(customer -> customer.isActive())
.map(customer -> customer.getName())
.map(name -> name.toUpperCase())
.peek(name -> System.out.println(name))
.toArray(count -> new String[count]);
// Method References
customers.stream()
.filter(Customer::isActive)
.map(Customer::getName)
.map(String::toUpperCase)
.peek(System.out::println)
.toArray(String[]::new);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment