Java tutorial
//package com.java2s; import java.util.Collection; public class Main { public static <I, T extends Collection<I>> T shallowCloneTo(Collection<I> srcCollection, T destCollection) { if (srcCollection == null || srcCollection.isEmpty()) return destCollection; destCollection.addAll(srcCollection); return destCollection; } }