Java Collection Remove removeElementsOfList(Collection set, Collection elementsToRemove)

Here you can find the source of removeElementsOfList(Collection set, Collection elementsToRemove)

Description

remove Elements Of List

License

Open Source License

Declaration

public static <E extends Collection<E>> Collection<E> removeElementsOfList(Collection<E> set,
            Collection<E> elementsToRemove) 

Method Source Code

//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;

    }
}

Related

  1. removeDuplicates(Collection p_collection)
  2. removeDuplicates(Collection objects)
  3. removeDuplicates(Collection elements)
  4. removeElement(Collection coll)
  5. removeElement(final int index, final Collection coll)
  6. removeIfNotPresent(Collection collection, Collection permitted)
  7. removeOutStrings(Collection values, String newString)
  8. removeRightSet(Collection left, Collection right)
  9. removeSafe(Collection collection, V value)