Here you can find the source of containsSome(Set one, Set two)
public static boolean containsSome(Set one, Set two)
//package com.java2s; // This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. import java.util.Iterator; import java.util.Set; public class Main { /**/*from ww w .jav a 2 s . c om*/ * Test if one set has overlapping membership with another set */ public static boolean containsSome(Set one, Set two) { Iterator it = two.iterator(); while (it.hasNext()) { if (one.contains(it.next())) { return true; } } return false; } }