Java Set Intersect intersects(Set set1, Set set2)

Here you can find the source of intersects(Set set1, Set set2)

Description

intersects

License

Open Source License

Declaration

public static <T> boolean intersects(Set<T> set1, Set<T> set2) 

Method Source Code


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

import java.util.*;

public class Main {
    public static <T> boolean intersects(Set<T> set1, Set<T> set2) {
        if (set1.size() > set2.size())
            return intersects(set2, set1);
        for (T x : set1)
            if (set2.contains(x))
                return true;
        return false;
    }//from ww w . j  a  va  2s .  c o m
}

Related

  1. intersection(Set first, Set second)
  2. intersection(Set s1, Set s2)
  3. intersection(Set setA, Set setB)
  4. intersection(Set setA, Set setB)
  5. intersectionP(Set s1, Set s2)
  6. intersectSet(Set orig, Set intersect)
  7. intersectsWith(final Set a, final Set b)
  8. intersectTwoSets(Set a, Set b)