Java tutorial
import java.util.ArrayList; import java.util.Collection; public class Utils { public static <T> Collection<T> diff(Collection<T> c1, Collection<T> c2) { if (c1 == null || c1.size() == 0 || c2 == null || c2.size() == 0) { return c1; } Collection<T> difference = new ArrayList<T>(); for (T item : c1) { if (!c2.contains(item)) { difference.add(item); } } return difference; } }