Java tutorial
//package com.java2s; //License from project: Open Source License import java.util.*; public class Main { @SuppressWarnings("unchecked") public static <T> Collection<T> unique(Collection<T> c, Collection<T> result) { if (c == null) { return result; } Set<T> s = new LinkedHashSet<T>(c); result.addAll(s); return result; } }