JEP 186: Collection Literals
Paul Benedict
pbenedict at apache.org
Tue Jan 14 07:30:13 PST 2014
I would like to see Java have one way of doing initialization with a series
of values. C11/C++11 decided that curly braces was the way to go. So I
would agree with Moshe we should favor curly braces over any new syntax.
On Tue, Jan 14, 2014 at 8:34 AM, Millies, Sebastian <
Sebastian.Millies at softwareag.com> wrote:
> I would certainly expect it to be an immutable list, and I believe the
> proposal of having collection literals makes most sense in the context of
> persistent collections. This would be in keeping with evolving Java towards
> a more functional and parallel-friendly programming style, which entails
> embracing immutability. In contrast, what's to be gained from a shorter
> version of Arrays.asList() ? -- Sebastian
>
> -----Original Message-----
> From: lambda-dev-bounces at openjdk.java.net [mailto:
> lambda-dev-bounces at openjdk.java.net] On Behalf Of Moshe Sayag
> Sent: Tuesday, January 14, 2014 2:52 PM
> To: lambda-dev at openjdk.java.net
> Subject: Re: JEP 186: Collection Literals
>
> 1. What is the exact meaning of:
>
> List<Integer> list = #[ 1, 2, 3 ];
>
> Will 'list' be an ArrayList, a LinkedList or an immutable list?
>
> 2. Java already has the curly brackets {...} to construct an array.
>
> int[] array = { 1, 2, 3 };
>
> How will the new literal go with it?
> Will we have:
>
> int[] array = #[ 1, 2, 3 ];
>
> What about
>
> List<Integer> list = { 1, 2, 3 };
>
>
> Moshe
>
>
> On Tue, Jan 14, 2014 at 2:17 AM, <mark.reinhold at oracle.com> wrote:
>
> > Posted: http://openjdk.java.net/jeps/186
> >
> > - Mark
> >
> >
>
>
> Software AG – Sitz/Registered office: Uhlandstraße 12, 64297 Darmstadt,
> Germany – Registergericht/Commercial register: Darmstadt HRB 1562 -
> Vorstand/Management Board: Karl-Heinz Streibich (Vorsitzender/Chairman),
> Dr. Wolfram Jost, Arnd Zinnhardt; - Aufsichtsratsvorsitzender/Chairman of
> the Supervisory Board: Dr. Andreas Bereczky - http://www.softwareag.com
>
>
>
--
Cheers,
Paul
More information about the lambda-dev
mailing list