Here you can find the source of removeAllElements(Collection
public static <T> void removeAllElements(Collection<T> data, T value)
//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); } }