Java Utililty Methods Collection Contain

List of utility methods to do Collection Contain

Description

The list of methods to do Collection Contain are organized into topic(s).

Method

booleancontainsAny(Collection c1, Collection c2)
Check whether c2 contains any element in c1.
for (final E elem : c1) {
    if (c2.contains(elem)) {
        return true;
return false;
booleancontainsAny(Collection set, Iterable elements)
contains Any
if (set == null)
    return false;
for (Integer elem : elements)
    if (set.contains(elem))
        return true;
return false;
booleancontainsAny(Collection c, String... toCheck)
Returns true if the passed collection contains any String in the passed String[]
if (c != null) {
    for (String s : toCheck) {
        if (c.contains(s)) {
            return true;
return false;
...
booleancontainsAny(Collection strs, Collection searchTerms)
contains Any
for (String str : strs) {
    if (containsAny(str, searchTerms)) {
        return true;
return false;
booleancontainsAny(Collection collection, Collection query)
contains Any
if (collection == null || collection.isEmpty() || query == null || query.isEmpty())
    return false;
for (T val : query) {
    if (collection.contains(val))
        return true;
return false;
booleancontainsAny(Collection collection, Collection toCheck)
if any item in toCheck is present in collection
for (T c : toCheck) {
    if (collection.contains(c))
        return true;
return false;
booleancontainsAny(Collection list, Collection values)
contains Any
if (list != null) {
    for (T o : values) {
        if (list.contains(o)) {
            return true;
return false;
...
booleancontainsAny(Collection src, Collection containsAny)
contains Any
for (T elem : containsAny) {
    if (src.contains(elem)) {
        return true;
return false;
booleancontainsAny(Collection firstCollection, Collection secondCollection)
contains Any
for (V firstCollectionValue : firstCollection) {
    for (V secondCollectionValue : secondCollection) {
        if (firstCollectionValue != null && firstCollectionValue.equals(secondCollectionValue)) {
            return true;
return false;
...
booleancontainsAny(final Collection a, final Collection b)
Returns true iff some element of a is also an element of b (or, equivalently, if some element of b is also an element of a).
for (Iterator iter = a.iterator(); iter.hasNext();) {
    if (b.contains(iter.next())) {
        return true;
return false;