(a, b) -> a + b
a -> ...
(Long a) -> { println(a); }
The parameters are on the left side of the ->.
If a parameter uses type inference (it has no type specified) then its type is set to UnknownType.
If they are in ( ), "isEnclosingParameters" is true.
The body is to the right of the ->.
The body is either a BlockStmt when it is in { } braces, or an ExpressionStmt when it is not in braces.
| Modifier and Type | Field and Description |
|---|---|
| private Statement | |
| private boolean | |
| private NodeList |
| Access | Constructor and Description |
|---|---|
| public | |
| public | |
| public | LambdaExpr(NodeList<Parameter> parameters, BlockStmt body)
Creates a zero or multi-parameter lambda expression with its parameters wrapped in ( ). |
| public | |
| public | LambdaExpr(NodeList<Parameter> parameters, Expression body)
Creates a zero or multi-parameter lambda expression with its parameters wrapped in ( ). |
| public | |
| public | LambdaExpr(TokenRange tokenRange, NodeList<Parameter> parameters, Statement body, boolean isEnclosingParameters)
This constructor is used by the parser and is considered private. |
| Modifier and Type | Method and Description |
|---|---|
| public <R, A> R | accept(final GenericVisitor<R, A>
the visitor implementation v, final A the argument passed to the visitor (of type A) arg)Implements com. |
| public <A> void | accept(final VoidVisitor<A>
the visitor implementation v, final A any value relevant for the visitor (of type A) arg)Implements com. |
| public LambdaExpr | |
| public LambdaExpr | clone()
Creates and returns a copy of this object.
|
| public Statement | |
| public Optional | Returns: if the body of this lambda is a simple expression, return that expression. Otherwise (when the body is a block) return Optional.empty().
|
| public LambdaExprMetaModel | |
| public NodeList | |
| public void | ifLambdaExpr(Consumer<LambdaExpr> action)
Overrides com. |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | replace(Node node, Node replacementNode)
Overrides com. |
| public LambdaExpr | |
| public LambdaExpr | |
| public LambdaExpr | setParameters(final NodeList<Parameter> parameters)
Implements com. |
| public Optional |
| body | back to summary |
|---|---|
| private Statement body | |
| isEnclosingParameters | back to summary |
|---|---|
| private boolean isEnclosingParameters | |
| parameters | back to summary |
|---|---|
| private NodeList<Parameter> parameters | |
| LambdaExpr | back to summary |
|---|---|
| public LambdaExpr() | |
| LambdaExpr | back to summary |
|---|---|
| public LambdaExpr(Parameter parameter, BlockStmt body) Creates a single parameter lambda expression. | |
| LambdaExpr | back to summary |
|---|---|
| public LambdaExpr(NodeList<Parameter> parameters, BlockStmt body) Creates a zero or multi-parameter lambda expression with its parameters wrapped in ( ). | |
| LambdaExpr | back to summary |
|---|---|
| public LambdaExpr(Parameter parameter, Expression body) Creates a single parameter lambda expression. | |
| LambdaExpr | back to summary |
|---|---|
| public LambdaExpr(NodeList<Parameter> parameters, Expression body) Creates a zero or multi-parameter lambda expression with its parameters wrapped in ( ). | |
| LambdaExpr | back to summary |
|---|---|
public LambdaExpr(NodeList<Parameter> parameters, Statement body, boolean isEnclosingParameters)
| |
| LambdaExpr | back to summary |
|---|---|
| public LambdaExpr(TokenRange tokenRange, NodeList<Parameter> parameters, Statement body, boolean isEnclosingParameters) This constructor is used by the parser and is considered private.
| |
| accept | back to summary |
|---|---|
| public <R, A> R accept(final GenericVisitor<R, A> v, final A arg) Implements com. Doc from com. Accept method for visitor support.
| |
| accept | back to summary |
|---|---|
| public <A> void accept(final VoidVisitor<A> v, final A arg) Implements com. Doc from com. Accept method for visitor support.
| |
| asLambdaExpr | back to summary |
|---|---|
| public LambdaExpr asLambdaExpr() Overrides com.
| |
| clone | back to summary |
|---|---|
| public LambdaExpr clone() Overrides com. Doc from java. Creates and returns a copy of this object. The precise meaning
of "copy" may depend on the class of the object. The general
intent is that, for any object will be true, and that the expression:x.clone() != x will bex.clone().getClass() == x.getClass() true, but these are not absolute requirements.
While it is typically the case that:
will bex.clone().equals(x) true, this is not an absolute requirement.
By convention, the returned object should be obtained by calling
By convention, the object returned by this method should be independent
of this object (which is being cloned). To achieve this independence,
it may be necessary to modify one or more fields of the object returned
by
| |
| getBody | back to summary |
|---|---|
public Statement getBody()
| |
| getExpressionBody | back to summary |
|---|---|
public Optional
| |
| getMetaModel | back to summary |
|---|---|
| public LambdaExprMetaModel getMetaModel() Overrides com.
| |
| getParameters | back to summary |
|---|---|
| public NodeList Implements com.
| |
| ifLambdaExpr | back to summary |
|---|---|
| public void ifLambdaExpr(Consumer<LambdaExpr> action) Overrides com.
| |
| isEnclosingParameters | back to summary |
|---|---|
public boolean isEnclosingParameters()
| |
| isLambdaExpr | back to summary |
|---|---|
| public boolean isLambdaExpr() Overrides com.
| |
| remove | back to summary |
|---|---|
| public boolean remove(Node node) Overrides com.
| |
| replace | back to summary |
|---|---|
| public boolean replace(Node node, Node replacementNode) Overrides com.
| |
| setBody | back to summary |
|---|---|
public LambdaExpr setBody(final Statement body)
| |
| setEnclosingParameters | back to summary |
|---|---|
public LambdaExpr setEnclosingParameters(final boolean isEnclosingParameters)
| |
| setParameters | back to summary |
|---|---|
| public LambdaExpr setParameters(final NodeList<Parameter> parameters) Implements com.
| |
| toLambdaExpr | back to summary |
|---|---|
| public Optional Overrides com.
| |