Java Collection Remove removeAll(Collection c, T... array)

Here you can find the source of removeAll(Collection c, T... array)

Description

Removes objects in array to the given collection

License

Apache License

Parameter

Parameter Description
c collection from which remove each element of array.
array ~ items

Return

the same collection which is passed as argument(but without element from array)

Declaration

public static <E, T extends E> Collection<E> removeAll(Collection<E> c, T... array) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.Collection;

public class Main {
    /**/* w  ww.j  av  a  2  s  . c om*/
     * Removes objects in array to the given collection
     * 
     * @param c
     *            collection from which remove each element of array.
     * @param array
     *            ~ items
     * @return the same collection which is passed as argument(but without
     *         element from array)
     */
    public static <E, T extends E> Collection<E> removeAll(Collection<E> c, T... array) {
        for (T obj : array) {
            c.remove(obj);
        }
        return c;
    }
}

Related

  1. remove(final int index, final Collection collection)
  2. removeAll(Collection collection, Collection remove)
  3. removeAll(Collection source, Set remove)
  4. removeAll(Collection c, Iterable elts)
  5. removeAll(Collection c, Object e)
  6. removeAll(Collection c, T... array)
  7. removeAll(Collection ret, Object[] elements)
  8. removeAll(Collection collection, Collection remove)
  9. removeAll(Collection collection, T... elementsToRemove)

  10. HOME | Copyright © www.java2s.com 2016