List of utility methods to do Collection Check
boolean | isCollectionOrArray(final Class> cls) Returns true if the supplied class is a collection or an array. return (cls.isArray() && byte[].class != cls) || Collection.class.isAssignableFrom(cls); |
boolean | isCollectionOrArray(final Object obj) Return true for objects that are collections or arrays (i.e. final Class<? extends Object> cls = obj.getClass(); return Collection.class.isAssignableFrom(cls) || cls.isArray(); |
boolean | isCollectionOrArrayType(Class> typeToCheck) is Collection Or Array Type return typeToCheck != null && (typeToCheck.isArray() || Collection.class.isAssignableFrom(typeToCheck)); |
boolean | isCollectionType(Class aClass) Determines if the given class is a Collection type. return Collection.class.isAssignableFrom(aClass); |
boolean | isCollectionType(Class type) Returns true if type is a collection type. return List.class.isAssignableFrom(type) || Set.class.isAssignableFrom(type); |
boolean | isCollectionType(Class> cls) is Collection Type if (cls.isArray()) { return true; } else if (List.class.isAssignableFrom(cls)) { return true; } else if (Set.class.isAssignableFrom(cls)) { return true; } else if (Map.class.isAssignableFrom(cls)) { return true; ... |
boolean | isCollectionType(Class> cls) Checks if provided class represents an array class or is implementation of java.util.Collection . return cls != null && (cls.isArray() || Collection.class.isAssignableFrom(cls)); |
boolean | isCollectionType(Class is Collection Type return Collection.class.isAssignableFrom(type) || Map.class.isAssignableFrom(type); |
boolean | isCollectionType(final Class> cls) is Collection Type return java.util.Collection.class.isAssignableFrom(cls); |
boolean | isCollectionType(Object obj) is Collection Type return (obj.getClass().isArray() || (obj instanceof Collection) || (obj instanceof Hashtable) || (obj instanceof HashMap) || (obj instanceof HashSet) || (obj instanceof List) || (obj instanceof AbstractMap)); |