JEP 186: Collection Literals
Brian Goetz
brian.goetz at oracle.com
Wed Jan 15 09:22:31 PST 2014
> (1) Target-typing means you don't have to redundantly specify T:
>
> T v = { e1, ..., en};
>
> vs
>
> T v = T.of(e1, ..., en);
>
> (2) Using the T.of form requires allocating an array,
> which is then thrown away.
>
> I don't think (2) is a major justification. (1) may not
> be enough to justify a new language feature by itself,
> though one could argue it's a natural extension of the
> existing syntax for arrays.
Agreed regarding (2); I'd rather spend our budget on optimizing varargs
invocations.
Regarding (1), its also important to be mindful of cost. While the
syntax is nice, is it worth the 100x-plus increase in cost?
More information about the lambda-dev
mailing list