Java Utililty Methods Collection Check

List of utility methods to do Collection Check

Description

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

Method

booleanisBlank(Collection c)
is Blank
return c != null && c.isEmpty();
booleanisBlank(Collection collection)
is Blank
return collection == null || collection.size() == 0;
booleanisBlank(final Collection c)
Check if a collection of a string is blank.
if (c == null || c.isEmpty()) {
    return false;
for (final String text : c) {
    if (isNotBlank(text)) {
        return false;
return true;
booleanisBlank(final Collection collection)
is Blank
return (collection == null) || isEmpty(collection);
booleanisBlankAll(Collection... collections)
is Blank All
for (Collection<?> c : collections) {
    if (!isBlank(c)) {
        return false;
return true;
booleanisC2InC1(Collection c1, Collection c2)
return true if all elements of c2 are in c1
for (T e1 : c1) {
    boolean e1found = false;
    for (T theirPlayer : c2) {
        if (e1.equals(theirPlayer)) {
            e1found = true;
            break;
    if (!e1found) {
        return false;
return true;
intisClassCollection(Class c)
is Class Collection
if (Collection.class.isAssignableFrom(c)) {
    return 1;
} else if (Map.class.isAssignableFrom(c)) {
    return 2;
} else {
    return 0;
booleanisClassCollection(Class c)
Check if a current class can be cast to collection.
return Collection.class.isAssignableFrom(c) || Map.class.isAssignableFrom(c);
booleanisClassCollection(Class type)
is Class Collection
checkNull(type);
boolean collection = false;
if (Collection.class.isAssignableFrom(type)) {
    collection = true;
return collection;
booleanisCollection(Class c)
Returns true if the specified class is a Collection, otherwise it returns false
return containsInterface(c, "java.util.Collection") || isSet(c) || isList(c);