Here you can find the source of intersectionP(Set
static public <T> boolean intersectionP(Set<T> s1, Set<T> s2)
//package com.java2s; import java.util.*; public class Main { static public <T> boolean intersectionP(Set<T> s1, Set<T> s2) { Set<T> x = null;// w w w . j ava2 s.com Set<T> y = null; if (s1.size() < s2.size()) return _intersectionP(s1, s2); else return _intersectionP(s2, s1); } static private <T> boolean _intersectionP(Set<T> s1, Set<T> s2) { for (Iterator<T> iter = s1.iterator(); iter.hasNext();) { Object elt = iter.next(); if (s2.contains(elt)) return true; } return false; } }