I recently found out that there are actually 2 different ArrayList
implementations in Java (better late than never I guess...).
So I was wondering why does Arrays.asList(T... a)
need to return a list which can not be resized ? If they needed an unmodifiable list why add the set(int index, E element)
method then ?
So my general question is why not return the java.util.ArrayList
from the Arrays.asList(T... a)
method ?
Also what do you gain with the java.util.Arrays.ArrayList
implementation ?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…