Java Collection Contain containsAny(Collection c, String... toCheck)

Here you can find the source of containsAny(Collection c, String... toCheck)

Description

Returns true if the passed collection contains any String in the passed String[]

License

Open Source License

Declaration

public static boolean containsAny(Collection<String> c, String... toCheck) 

Method Source Code

//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;
    }
}

Related

  1. containsAny(Collection source, Collection candidates)
  2. containsAny(Collection source, Object... candidates)
  3. containsAny(Collection collection1, Collection collection2)
  4. containsAny(Collection c1, Collection c2)
  5. containsAny(Collection set, Iterable elements)
  6. containsAny(Collection strs, Collection searchTerms)
  7. containsAny(Collection collection, Collection query)
  8. containsAny(Collection collection, Collection toCheck)
  9. containsAny(Collection list, Collection values)