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

booleancontains(Collection mainCollection, String str)
contains
String[] mainArr = new String[mainCollection.size()];
return contains(mainCollection.toArray(mainArr), str);
booleancontains(Collection c1, Collection c2)
contains
boolean flag = true;
for (T t : c2) {
    if (!c1.contains(t)) {
        flag = false;
        break;
return flag;
...
booleancontains(Collection collection, T item)
Checks if the given collection contains the specified item.
return collection.contains(item);
booleancontains(final Collection mimeTypes, final MimeType mimeType)
Checks if a specific MimeType is in a collection of mime types
if (mimeTypes == null) {
    throw new IllegalArgumentException("The collection of mimeTypes cannot be null.");
if (mimeType == null) {
    throw new IllegalArgumentException("mimeType cannot be null.");
return mimeTypes.stream().filter(format -> format != null)
        .anyMatch(allowedImageOutputFormat -> allowedImageOutputFormat.match(mimeType));
...
booleancontains(final Collection c, final T o)
contains
return (c != null && c.contains(o));
booleancontains(Object o, Collection c)
contains
if (c == null) {
    return false;
return c.contains(o);
booleancontainsAll(Collection c, Iterable subset)
Test whether a collection contains all the elements of a list.
if (subset instanceof Collection<?>) {
    return c.containsAll((Collection<?>) subset);
} else {
    for (Object o : subset) {
        if (!c.contains(o)) {
            return false;
    return true;
booleancontainsAll(Collection coll, Collection other)
contains All
for (Object otherElement : other) {
    if (!coll.contains(otherElement))
        return false;
return true;
booleancontainsAll(Collection collectionToCheck, Collection items)
contains All
for (Object o : items) {
    if (!collectionToCheck.contains(o)) {
        return false;
return true;
booleancontainsAll(final Collection c, final Object... array)
contains All
for (int i = 0; i < array.length; i++) {
    if (!c.contains(array[i])) {
        return false;
return true;