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(final Collection coll1, final Collection coll2)
Returns true iff at least one element is in both collections.
if (coll1.size() < coll2.size()) {
    for (Iterator it = coll1.iterator(); it.hasNext();) {
        if (coll2.contains(it.next())) {
            return true;
} else {
    for (Iterator it = coll2.iterator(); it.hasNext();) {
...
booleancontainsAny(final Collection collection, final Object... items)
contains Any
if (collection != null) {
    for (final Object item : items) {
        final boolean b = collection.contains(item);
        if (b) {
            return true;
return false;
booleancontainsAny(final Collection collection1, final Collection collection2)
contains Any
for (final Object value : collection1) {
    if (collection2.contains(value)) {
        return true;
return false;
booleancontainsAny(final Collection a, final Collection b)
contains Any
for (Iterator<B> it = b.iterator(); it.hasNext();)
    if (a.contains(it.next()))
        return true;
return false;
booleancontainsAnyIgnoreCase(String string, Collection searchStrings)
Indicates whether the given string contains any of the given search strings.
if (string == null || searchStrings == null) {
    return false;
for (String searchString : searchStrings) {
    if (string.trim().toLowerCase().contains(searchString.trim().toLowerCase())) {
        return true;
return false;
booleancontainsAnyNull(Collection source)
contains Any Null
if (source == null || source.isEmpty()) {
    return true;
for (Object o : source) {
    if (o == null) {
        return true;
return false;
booleancontainsAnyOf(String s, Collection values)
contains Any Of
if (s == null)
    return false;
for (Iterator i$ = values.iterator(); i$.hasNext();) {
    String value = (String) i$.next();
    if (s.contains(value))
        return true;
return false;
...
booleancontainsAnyVariables(Collection propertyValues)
contains Any Variables
for (String propertyValue : propertyValues) {
    if (propertyValue.contains(VARIABLE_START)) {
        return true;
return false;
booleancontainsAssignableClass(Collection> clses, Class clazz)
contains Assignable Class
for (Class<?> cls : clses) {
    if (cls.isAssignableFrom(clazz)) {
        return true;
return false;
booleancontainsAtLeastOne(Collection origin, Collection elements)
Return true if origin collection contains at least one element from another collection
boolean result = false;
for (Object element : elements) {
    if (origin.contains(element)) {
        result = true;
        break;
return result;
...