Java Set Intersect intersection(Set s1, Set s2)

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

Description

intersection

License

Open Source License

Declaration

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

Method Source Code


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

public class Main {
    static public <T> Set<T> intersection(Set<T> s1, Set<T> s2) {
        Set<T> s3 = new HashSet<T>(s1);
        s3.retainAll(s2);//from w  w w .  j  a  v a2s  . c o  m
        return s3;
    }
}

Related

  1. intersectComparable(Set left, Set right)
  2. intersection(final Set set1, final Set set2)
  3. intersection(Set a, Set b)
  4. intersection(Set sa, Set sb)
  5. intersection(Set first, Set second)
  6. intersection(Set setA, Set setB)
  7. intersection(Set setA, Set setB)
  8. intersectionP(Set s1, Set s2)
  9. intersects(Set set1, Set set2)