标签:
1. What is the difference between
i. List<Integer> list1 = new ArrayList<Integer>(Arrays.asList(ia)); ii. List<Integer> list2 = Arrays.asList(ia);
i. new ArrayList<Integer>(Arrays.asList(ia))
ArrayList
is an independent copy of the original one. Arrays.asList
, it is used only during the construction of the new ArrayList
and is garbage-collected afterwards.ii. Arrays.asList(ia)
ia
and creates a wrapper that implements List<Integer>
, which makes the original array as a list. ArrayList
-- ArrayList
s have their own, internal array, which they are able to resize.
2.
标签:
原文地址:http://www.cnblogs.com/joycelee/p/5792235.html