Class LambdaVarExamples
java.lang.Object
net.jrodolfo.java_evolution.java11.LambdaVarExamples
Demonstrates
var in lambda parameters, introduced in Java 11.
Java 10 introduced var for local variables. Lambda parameters could
already have inferred types, but there was no syntax for annotating those
inferred parameters.
Java 11 allowed var in lambda parameter lists. The main benefit is
not saving characters; it makes inferred lambda parameters consistent with
local variables and allows annotations on them.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic @interfaceMarker annotation used only to demonstrate annotating an inferred lambda parameter. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionnameLengths(List<String> names) Uses an annotation on a lambda parameter whose type is inferred withvar.normalizeNames(List<String> names) Usesvarfor an inferred lambda parameter.
-
Constructor Details
-
LambdaVarExamples
public LambdaVarExamples()
-
-
Method Details
-
normalizeNames
-
nameLengths
-