JEP 186: Collection Literals

Millies, Sebastian Sebastian.Millies at softwareag.com
Tue Jan 14 06:34:25 PST 2014


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



More information about the lambda-dev mailing list