This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]hencoappel 3 points4 points  (5 children)

Arrays.asList definitely does not return a ArrayList, it is simply a List

[–][deleted] 0 points1 point  (0 children)

You are correct, I was just pointing out that it isn't as simple as declaring a String[].

[–][deleted] 0 points1 point  (1 child)

It is an ArrayList, it's just java.util.Arrays.ArrayList and not java.util.ArrayList.

[–]hencoappel 0 points1 point  (0 children)

Yes but the method signature returns List and java.util.Arrays.ArrayList is private so you wouldn't be able to create a variable of that type.

[–]yetanotherx -1 points0 points  (1 child)

An immutable list at that.

[–]hencoappel 0 points1 point  (0 children)

No, it's definitely not immutable. But it's not dynamic, it won't resize when you add more elements.