Java tutorial
//package com.java2s; import java.util.Collection; public class Main { public static <T> T copyT(Collection<? super T> dest, Collection<T> src) { T last = null; for (T t : src) { last = t; dest.add(t); } return last; } }