Here you can find the source of containsAny(Set
public static <T> boolean containsAny(Set<T> container, Set<T> possibilities)
//package com.java2s; /**//from w w w . j av a2 s .c o m * Utilities.java * --------------------------------- * Copyright (c) 2014 * RESOLVE Software Research Group * School of Computing * Clemson University * All rights reserved. * --------------------------------- * This file is subject to the terms and conditions defined in * file 'LICENSE.txt', which is part of this source code package. */ import java.util.Iterator; import java.util.Set; public class Main { public static <T> boolean containsAny(Set<T> container, Set<T> possibilities) { boolean result = false; Iterator<T> possibilitiesIter = possibilities.iterator(); while (!result && possibilitiesIter.hasNext()) { result = container.contains(possibilitiesIter.next()); } return result; } }