Contexts for target typing - Array initializers
Deepak S Patwardhan
deepak.patwardhan at itaas.com
Fri Aug 3 23:27:20 PDT 2012
Hello,
State of lambda, v4, Section 5 gives the following example for lambda
expressions inside array initializers.
runAll(new Callable<String>[]{ ()->"a", ()->"b", ()->"c" });
It doesn't work because Java does not allow creation of an array of a
generic type.
We can instantiate the raw type (works with build 50)
runAll(new Callable[] { () -> "a", () -> 'b', () -> 99 });
So, the original example is never supposed to work, right? (unless or until
Java allows creation of arrays of generic type)
regards,
Deepak S Patwardhan.
More information about the lambda-dev
mailing list