Java Collection Subtract subtract(Collection l1, Collection l2)

Here you can find the source of subtract(Collection l1, Collection l2)

Description

subtract

License

Open Source License

Declaration

public static <T> ArrayList<T> subtract(Collection<T> l1, Collection<T> l2) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.util.ArrayList;
import java.util.Collection;

public class Main {
    public static <T> ArrayList<T> subtract(Collection<T> l1, Collection<T> l2) {
        ArrayList<T> al = new ArrayList<T>();
        al.addAll(l1);// ww w  .j a  v  a 2  s .com
        for (T item : l2) {
            al.remove(item);
        }
        return al;
    }
}

Related

  1. subtract(Collection a, Collection b)
  2. subtract(Collection c1, Collection c2)
  3. subtract(Collection a, Collection b)
  4. subtract(Collection c1, Collection c2)
  5. subtract(Collection l1, Collection l2)
  6. subtract(final Collection a, final Collection b)
  7. subtract(final Collection a, final Collection b)
  8. subtract(final Collection a, final Collection b)
  9. subtract(final Collection a, final Collection b)