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(Object ob)
Check if a current object can be cast to collection.
return ob != null && isClassCollection(ob.getClass());
booleanisCollection(Object obj)
Checks if provided object is java.util.Collection or Object[] .
return obj instanceof Object[] || obj instanceof Collection;
booleanisCollection(Object obj)
Determines if the given object is any kind of collection
return (obj != null && java.util.Collection.class.isAssignableFrom(obj.getClass()));
booleanisCollection(Object obj)
is Collection
if (obj != null && Collection.class.isAssignableFrom(obj.getClass())) {
    return true;
return false;
booleanisCollection(Object object)
Returns true if the given Object is not null and a Collection derived type
return isAssignableFromInstance(Collection.class, object);
booleanisCollection(Object object)
is Collection
if (object == null)
    return false;
return object instanceof java.util.Collection<?>;
booleanisCollection(Object value)
Returns true if value is either a collection or an array; false otherwise.
return value == null ? false : value instanceof Collection<?> || value.getClass().isArray();
booleanisCollection(String type)
is Collection
return isList(type) || isSet(type);
booleanisCollectional(final Class type)
Indicates whether type represents Collection -typed values.
return Collection.class.isAssignableFrom(type);
booleanisCollectionOrArray(Class type)
is Collection Or Array
return isCollection(type) || type.isArray();