Java tutorial
//package com.java2s; import java.util.ArrayList; import java.util.Collection; public class Main { public static <T> Collection<T> merge(Collection<T>... col) { //ensure maximum capacity Collection<T> result = new ArrayList(col.length); for (Collection<T> c : col) { if (c != null) result.addAll(c); } return result; } }