Here you can find the source of containsAny(Collection
private static <T> boolean containsAny(Collection<T> src, Collection<T> containsAny)
//package com.java2s; //License from project: Open Source License import java.util.Collection; public class Main { private static <T> boolean containsAny(Collection<T> src, Collection<T> containsAny) { for (T elem : containsAny) { if (src.contains(elem)) { return true; }/*from ww w . j a v a2s.c om*/ } return false; } }