Java Collection Remove removeAllElements(Collection data, T value)

Here you can find the source of removeAllElements(Collection data, T value)

Description

remove All Elements

License

Open Source License

Declaration

public static <T> void removeAllElements(Collection<T> data, T value) 

Method Source Code

//package com.java2s;
/*/*www . j a  v a  2  s  . c  o  m*/
 * Copyright (c) 2012 The ANTLR Project. All rights reserved.
 * Use of this file is governed by the BSD-3-Clause license that
 * can be found in the LICENSE.txt file in the project root.
 */

import java.util.Collection;

public class Main {
    public static <T> void removeAllElements(Collection<T> data, T value) {
        if (data == null)
            return;
        while (data.contains(value))
            data.remove(value);
    }
}

Related

  1. removeAll(Collection left, Collection right)
  2. removeAll(Collection source, Collection remove)
  3. removeAll(final Collection c, final Object... array)
  4. removeAll(final Collection collection, final Collection remove)
  5. removeAll(final Collection collection, final T... objects)
  6. removeAllFromCollection(Collection collection, Collection toRemove)
  7. removeAllFromSet(AbstractSet collection, Collection toRemove)
  8. removeAny(Collection collection)
  9. removeArrayMarkerFromCollectionToString(Collection col)