Java tutorial
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; import java.util.Collection; public class Main { /** * Returns all items in collection1 that are not in collection2 */ public static <T> Collection<T> subtractCollections(Collection<? extends T> collection1, Collection<? extends T> collection2) { Collection<T> result = new ArrayList<T>(collection1); result.removeAll(collection2); return result; } }