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 d
You asked:
Also what do you gain with the java.util.Arrays.ArrayList implementation ?
It is because the Arrays$ArrayList returned by Arrays.asList is just a view on the original array. So when the original array is changed then the view is changed too.
If one would use an real ArrayList then the elements will be copied, and a change on the orignal array would not infuence the ArrayList.
The reasons to do this are quite simple: