JEP 186: Collection Literals

Georgiy Rakov georgiy.rakov at oracle.com
Mon Feb 24 02:12:15 PST 2014


Just a though:

    Map.of(k1, v1; k2, v2; k3, v3);
    Map.of(k1 v1; k2 v2; k3 v3);
    Map.of(k1 v1, k2 v2, k3 v3);

Thanks,
Georgiy.

On 20.02.2014 23:55, Zhong Yu wrote:
> another design:
>
>      Map.k(k1, k2, ...)
>             .v(v1, v2, ...)
>
> but they all suck. We need literals for pair/tuples badly. Not so much
> for homogeneous collections.
>
> Zhong Yu
>
>
>
> On Thu, Feb 20, 2014 at 9:14 AM, Remi Forax <forax at univ-mlv.fr> wrote:
>> On 02/20/2014 03:47 PM, Stephen Colebourne wrote:
>> [...]
>>
>>> Personally, I can't see how a builder can possibly be as neat as
>>> List.of(1, 2, 3).
>>>
>>> Stephen
>> It's not incompatible,
>>     Map.of(1, "foo").of(2, "bar").toMap();
>>
>> Rémi
>>
>>



More information about the lambda-dev mailing list