Here you can find the source of containsAny(Collection
public static boolean containsAny(Collection<String> c, String... toCheck)
//package com.java2s; //License from project: Open Source License import java.util.Collection; public class Main { /**//from w w w .jav a 2s. com * Returns true if the passed collection contains any String in the passed String[] */ public static boolean containsAny(Collection<String> c, String... toCheck) { if (c != null) { for (String s : toCheck) { if (c.contains(s)) { return true; } } } return false; } }