Java Collection Subtract subtract(final Collection a, final Collection b)

Here you can find the source of subtract(final Collection a, final Collection b)

Description

subtract

License

Apache License

Declaration

public static <T> List<T> subtract(final Collection<T> a, final Collection<T> b) 

Method Source Code


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

import java.util.*;

public class Main {

    public static <T> List<T> subtract(final Collection<T> a, final Collection<T> b) {
        List<T> list = new ArrayList<T>(a);
        for (T element : b) {
            list.remove(element);/* w w w .ja  v  a2 s.co m*/
        }

        return list;
    }
}

Related

  1. subtract(Collection l1, Collection l2)
  2. subtract(Collection l1, Collection l2)
  3. subtract(final Collection a, final Collection b)
  4. subtract(final Collection a, final Collection b)
  5. subtract(final Collection a, final Collection b)
  6. subtractCollections(Collection collection1, Collection collection2)