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

booleanisCollection(Class clazz)
Is collection assignable
return isAssignable(Collection.class, clazz);
booleanisCollection(Class clazz)
is Collection
for (Class<?> claz : clazz.getInterfaces())
    if (claz == Collection.class)
        return true;
return false;
booleanisCollection(Class clazz)
Judge whether class is collection
return clazz.isAssignableFrom(List.class) || clazz.isAssignableFrom(Set.class)
        || clazz.isAssignableFrom(Collection.class);
booleanisCollection(Class klass)
is Collection
return Collection.class.isAssignableFrom(klass);
BooleanisCollection(Class type)
is Collection
return Collection.class.isAssignableFrom(type);
booleanisCollection(Class clazz)
Check whether a type is a collection (List, Set, ...).
if (clazz == null) {
    return false;
return Collection.class.isAssignableFrom(clazz);
booleanisCollection(Class fieldClass)
is Collection
return Collection.class.isAssignableFrom(fieldClass);
booleanisCollection(final Object collection)
Returns true if the collection is implements Collection; false otherwise.
return collection instanceof Collection;
booleanisCollection(final Object obj)
is Collection
return isInstanceof(obj, Collection.class);
booleanisCollection(final Object value)
Returns true if the given object is a non-null instance of Collection .
return isCollection(value, false);