There are two ways to copy a source list to a destination list. One way is to use ArrayList constructor
ArrayList dstList = new ArrayList(srcList);
The other is to use Collections.copy() (as below). Note the first line, we allocate a list at least as long as the source list, because in the javadoc of Collections, it says The destination list must be at least as long as the source list.
ArrayList<Integer> dstList = new ArrayList<Integer>(srcList.size());
Collections.copy(dstList, srcList);
Both methods are shallow copy. So what is the difference between these two methods?
First, Collections.copy() won't reallocate the capacity of dstList even if dstList does not have enough space to contain all srcList elements. Instead, it will throw an IndexOutOfBoundsException. One may question if there is any benefit of it. One reason is that it guarantees the method runs in linear time. Also it makes suitable when you would like to reuse arrays rather than allocate new memory in the constructor of ArrayList.
Collections.copy() can only accept List as both source and destination, while ArrayList accepts Collection as the parameter, therefore more general.