Here you can find the source of containsAny(Collection
Parameter | Description |
---|---|
collection | a parameter |
toCheck | a parameter |
public static <T> boolean containsAny(Collection<T> collection, Collection<T> toCheck)
//package com.java2s; import java.util.*; public class Main { /**//w ww . j a v a 2 s. co m * if any item in toCheck is present in collection * * @param collection * @param toCheck */ public static <T> boolean containsAny(Collection<T> collection, Collection<T> toCheck) { for (T c : toCheck) { if (collection.contains(c)) return true; } return false; } }