Java Reference
In-Depth Information
The output is shown here:
In the program, notice that the block lambda declares a variable called
result
, uses a
for
loop, and has a
return
statement. These are legal inside a block lambda body. In essence,
the block body of a lambda is similar to a method body. One other point. When a
return
statement occurs within a lambda expression, it simply causes a return from the lambda. It
does not cause an enclosing method to return.
Generic Functional Interfaces