Here you can find the source of removeElementsOfList(Collection
public static <E extends Collection<E>> Collection<E> removeElementsOfList(Collection<E> set, Collection<E> elementsToRemove)
//package com.java2s; //License from project: Open Source License import java.util.Collection; public class Main { public static <E extends Collection<E>> Collection<E> removeElementsOfList(Collection<E> set, Collection<E> elementsToRemove) { for (E element : elementsToRemove) { if (set.contains(element)) { set.remove(element);/*from ww w. j a va2s . c o m*/ } } return set; } }