Java tutorial
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; import java.util.Collection; public class Main { @SuppressWarnings({ "rawtypes", "unchecked" }) public static <T> Collection<T> substract(Collection<T> oldList, Collection<T> newList, java.util.Comparator comparator) { Collection<T> result = new ArrayList<T>(oldList); for (T oldValue : oldList) { for (T newValue : newList) { if (comparator.compare(oldValue, newValue) == 0) { result.remove(oldValue); } } } return result; } }