Java Set Difference difference(Set first, Set second)

Here you can find the source of difference(Set first, Set second)

Description

difference

License

Apache License

Declaration

public static <T> Set<T> difference(Set<T> first, Set<T> second) 

Method Source Code


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

import java.util.*;

public class Main {
    public static <T> Set<T> difference(Set<T> first, Set<T> second) {
        Set<T> copyOfFirst = new LinkedHashSet<>(first);
        copyOfFirst.removeAll(second);/*from  w  w w  .ja v  a  2  s .  c  om*/
        return copyOfFirst;
    }
}

Related

  1. computeDifference(Set a, Set b, String prefix, boolean exactMatch)
  2. diffAbyB(Set setA, Set setB)
  3. difference(final Set set1, final Set set2)
  4. difference(final Set first, final Set second)
  5. difference(Set a, Set b)
  6. difference(Set s1, Set s2)
  7. difference(Set setA, Set setB)