Java 8 Lambda Expressions: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
(Created page with "=External= * Lambda Expressions Tutorial https://docs.oracle.com/javase/tutorial/java/javaOO/lambdaexpressions.html =Internal= * java")
 
No edit summary
Line 6: Line 6:


* [[java#Subjects|java]]
* [[java#Subjects|java]]
=Overview=
=Syntax=
A lambda expression consists in a ''comma-separated list of formal parameters, enclosed in parentheses'', followed by the arrow token "->" followed by a ''body'', which may be a single expression or a statement block.
<pre>
(comma_separated_formal_parameter_list) -> body
</pre>
==Formal Parameters==
The type of the parameters may be omitted.
If there is a single parameter, the enclosed parentheses may be omitted.
==Body==
The body may be a single expression, or a statement block.

Revision as of 00:54, 28 November 2016

External

Internal

Overview

Syntax

A lambda expression consists in a comma-separated list of formal parameters, enclosed in parentheses, followed by the arrow token "->" followed by a body, which may be a single expression or a statement block.

(comma_separated_formal_parameter_list) -> body

Formal Parameters

The type of the parameters may be omitted.

If there is a single parameter, the enclosed parentheses may be omitted.

Body

The body may be a single expression, or a statement block.