Here you can find the source of subtractCollections(Collection extends T> collection1, Collection extends T> collection2)
public static <T> Collection<T> subtractCollections(Collection<? extends T> collection1, Collection<? extends T> collection2)
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; import java.util.Collection; public class Main { /**/*from w w w. j a v a2s . co m*/ * 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; } }