Here you can find the source of containsAny(final Collection a, final Collection b)
static <A, B> boolean containsAny(final Collection<A> a, final Collection<B> b)
//package com.java2s; //License from project: Open Source License import java.util.Collection; import java.util.Iterator; public class Main { static <A, B> boolean containsAny(final Collection<A> a, final Collection<B> b) { for (Iterator<B> it = b.iterator(); it.hasNext();) if (a.contains(it.next())) return true; return false; }//from ww w.java 2 s . c om }