Java tutorial
//package com.java2s; //License from project: Open Source License import java.util.Collection; public class Main { /** * if any item in toCheck is present in collection * * @param collection * @param toCheck */ public static <T> boolean containsAny(Collection<T> collection, Collection<T> toCheck) { for (T c : toCheck) { if (collection.contains(c)) return true; } return false; } }