JEP 186: Collection Literals

Remi Forax forax at univ-mlv.fr
Wed Jan 15 09:34:57 PST 2014


On 01/15/2014 06:22 PM, Brian Goetz wrote:
>> (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.

Here is the bug your looking for:
https://bugs.openjdk.java.net/browse/JDK-8013269

>
> Regarding (1), its also important to be mindful of cost.  While the
> syntax is nice, is it worth the 100x-plus increase in cost?
>

it's the question at 100x dollars :)

Rémi




More information about the lambda-dev mailing list