Java Utililty Methods Collection Minus

List of utility methods to do Collection Minus

Description

The list of methods to do Collection Minus are organized into topic(s).

Method

Listminus(Collection c1, Collection c2)
minus
List c1_ = new ArrayList();
if (isNotEmpty(c1)) {
    c1_.addAll(c1);
    c1_.removeAll(c2);
return c1_;
voidminus(Collection src, Collection ref)
minus
Iterator it = ref.iterator();
while (it.hasNext()) {
    Object obj = it.next();
    if (src.contains(obj))
        src.remove(obj);
return;
Collectionminus(Collection toBeDeletedFrom, Collection tobeDeleted)
minus
ArrayList result = new ArrayList(toBeDeletedFrom);
Iterator it = tobeDeleted.iterator();
while (it.hasNext()) {
    Object oj = it.next();
    if (toBeDeletedFrom.contains(oj)) {
        result.remove(oj);
return result;