Interface CtLambda<T>

Type Parameters:
T - created type
All Superinterfaces:
Cloneable, CtBodyHolder, CtCodeElement, CtElement, CtExecutable<T>, CtExpression<T>, CtNamedElement, CtQueryable, CtTypedElement<T>, CtVisitable, FactoryAccessor, Serializable, SourcePositionHolder, TemplateParameter<T>
All Known Implementing Classes:
CtLambdaImpl

public interface CtLambda<T> extends CtExpression<T>, CtExecutable<T>
This code element represents the creation of a lambda. A lambda can have two sorts of body : an simple expression or a block of statements. The usage of this concept in this class is:
     java.util.List l = new java.util.ArrayList();
     l.stream().map(
       x -> { return x.toString(); } // a lambda
     );
 
  • If your lambda has an expression, getBody method will return null and getExpression method will return a CtExpression.
  • If your lambda has a block of statement, getExpression method will return null and getBody will returns a CtBlock with all statements.
So keep this in mind when you would like the body of a CtLambda.