Idea to Java ArrayLists

kedar mhaswade kedar.mhaswade at gmail.com
Thu Jul 9 17:52:54 UTC 2015


Yeah, or LinkedList<String> strings = new LinkedList<>(Arrays.asList("1",
"2", "3"));

But I guess what Phillip really wants is to be able to *express*
ArrayList<String>
strings = ["1", "2", "3"]; and I believe there's a reason he can't have it
:-(

On Thu, Jul 9, 2015 at 10:46 AM, Louis Wasserman <lowasser at google.com>
wrote:

> Pavel, what you can do there is new ArrayList<>(Arrays.asList("1", "2",
> "3", "4", "5"));
>
> On Thu, Jul 9, 2015 at 10:40 AM Pavel Rappo <pavel.rappo at oracle.com>
> wrote:
>
>> Not quite. You don't have the ability to specify a particular
>> implementation
>> (e.g. the thing won't work if what you want is, say, LinkedList)
>>
>> > On 9 Jul 2015, at 18:34, kedar mhaswade <kedar.mhaswade at gmail.com>
>> wrote:
>> >
>> > Wouldn't Arrays.asList
>> > <
>> http://docs.oracle.com/javase/8/docs/api/java/util/Arrays.html#asList-T...-
>> >
>> > work for you?
>>
>>



More information about the core-libs-dev mailing list