Java Collection Difference difference(Collection set1, Collection set2)

Here you can find the source of difference(Collection set1, Collection set2)

Description

difference

License

Open Source License

Declaration

public static <E> Collection<E> difference(Collection<E> set1, Collection<E> set2) 

Method Source Code


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

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

import java.util.List;

public class Main {
    public static <E> Collection<E> difference(Collection<E> set1, Collection<E> set2) {
        List<E> differenceCopy = new ArrayList<E>();
        differenceCopy.addAll(set1);//from  w w w.  java2s.  c  o m
        differenceCopy.removeAll(set2);
        return differenceCopy;

    }
}

Related

  1. computeDifferenceIndices(Collection smallCollection, Collection bigCollection)
  2. diff(Collection c1, Collection c2)
  3. diffColls(Collection oldColl, Collection newColl)
  4. difference(Collection collection1, Collection result, Collection collection2)
  5. difference(Collection a, Collection b)
  6. difference(final Collection c1, final Collection c2)
  7. difference(final Collection c1, final Collection c2)