static bool containsAny(Collection a, Collection b) { if (empty(a)) false; Set set = asSet(b); for (A x : a) if (contains(set, x)) true; false; } static bool containsAny(Map a, Collection b) { if (empty(a)) false; Set set = asSet(b); for (A x : a) if (b.containsKey(x)) true; false; }