code: public static <E> boolean intersects(Set<E> s1, Set<E> s2) {
      // loop over whichever set is smaller
      if (s1.size() < s2.size()) {
        for (E element1 : s1) {
          if (s2.contains(element1)) {
            return true;
          }
        }
      } else {
        for (E element2 : s2) {
          if (s1.contains(element2)) {
            return true;
          }
        }
      }
      
      return false;
    }
docs: Returns true if there is at least element that is in both s1 and s2. Faster
  than calling intersection(Set,Set) if you don't need the contents of the
  intersection.