Java Set Difference difference(Set s1, Set s2)

Here you can find the source of difference(Set s1, Set s2)

Description

Return is s1 \ s2

License

Open Source License

Declaration


static public <T> Set<T> difference(Set<T> s1, Set<T> s2) 

Method Source Code


//package com.java2s;
import java.util.*;

public class Main {
    /** Return is s1 \ s2 */
//from   w  w  w  .  ja  v a  2  s. c  om
    static public <T> Set<T> difference(Set<T> s1, Set<T> s2) {
        Set<T> s3 = new HashSet<T>(s1);
        s3.removeAll(s2);
        return s3;
    }
}

Related

  1. diffAbyB(Set setA, Set setB)
  2. difference(final Set set1, final Set set2)
  3. difference(final Set first, final Set second)
  4. difference(Set a, Set b)
  5. difference(Set first, Set second)
  6. difference(Set setA, Set setB)