Java tutorial
//package com.java2s; //License from project: Open Source License import java.util.*; public class Main { public static <T> List<T> merge(List<T>... many) { ArrayList<T> ret = new ArrayList(); for (List<T> list : many) { if (list != null) { for (T val : list) { if (!ret.contains(val)) { ret.add(val); } } } } ret.trimToSize(); return ret; } public static <T> List<T> merge(T[]... many) { ArrayList<T> ret = new ArrayList(); for (T[] list : many) { if (list != null) { for (T val : list) { if (!ret.contains(val)) { ret.add(val); } } } } ret.trimToSize(); return ret; } }