Package modernfeatures.java11
Class VarInLambdaDemo
java.lang.Object
modernfeatures.java11.VarInLambdaDemo
Demonstrates the use of
var
in lambda parameters introduced in Java 11.
This includes examples of using var
alone, with final
, and with custom annotations
on lambda parameters to enhance readability and enable static analysis or framework integrations.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
Shows different ways to declare lambda parameters: - Traditional explicit type declaration - Usingvar
keyword - Usingfinal var
to make the parameter effectively final - Using a custom annotation on thevar
parameter Each approach demonstrates how lambda parameters can be declared and annotated in Java 11 and beyond.
-
Constructor Details
-
VarInLambdaDemo
public VarInLambdaDemo()
-
-
Method Details
-
main
Shows different ways to declare lambda parameters: - Traditional explicit type declaration - Usingvar
keyword - Usingfinal var
to make the parameter effectively final - Using a custom annotation on thevar
parameter Each approach demonstrates how lambda parameters can be declared and annotated in Java 11 and beyond.
-