Here you can find the source of containsSome(HashSet
public static <T> boolean containsSome(HashSet<T> s1, Collection<T> other)
//package com.java2s; //License from project: BSD License import java.util.*; public class Main { public static <T> boolean containsSome(HashSet<T> s1, Collection<T> other) { for (T t : other) if (s1.contains(t)) return true; return false; }/*from w w w . jav a2 s .c o m*/ public static <T> boolean contains(T[] ts, T t) { for (int i = 0; i < ts.length; i++) if (t.equals(ts[i])) return true; return false; } }