Here you can find the source of shallowCopy(Collection
public static <T> Collection<T> shallowCopy(Collection<T> collection)
//package com.java2s; //License from project: Apache License import java.util.Collection; import java.util.ArrayList; public class Main { public static <T> Collection<T> shallowCopy(Collection<T> collection) { ArrayList<T> copied = new ArrayList<T>(collection.size()); for (T element : collection) { copied.add(element);/*from ww w .j ava2 s .co m*/ } return copied; } }