Creating a Multi-Parameter Lambda Expression

 
friends.stream()
 
.reduce((name1, name2) ->
 
name1.length() >= name2.length() ? name1 : name2);

The parentheses () around the parameter list are required if the lambda expression takes multiple parameters or no parameters.

Get Functional Programming in Java now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.