Java Collection Check isCollectionOrArray(Class type)

Here you can find the source of isCollectionOrArray(Class type)

Description

is Collection Or Array

License

Apache License

Parameter

Parameter Description
type a parameter

Return

true if it's a collection or an array type.

Declaration

public static boolean isCollectionOrArray(Class<?> type) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.Collection;

public class Main {
    /**/* www .ja  v a  2 s.c  o m*/
     * @param type
     * @return true if it's a collection or an array type.
     */
    public static boolean isCollectionOrArray(Class<?> type) {
        return isCollection(type) || type.isArray();
    }

    /**
     * @param type
     * @return true if the type can be assigned to a {@link Collection} class
     */
    public static boolean isCollection(Class<?> type) {
        return Collection.class.isAssignableFrom(type);
    }
}

Related

  1. isCollection(Object object)
  2. isCollection(Object object)
  3. isCollection(Object value)
  4. isCollection(String type)
  5. isCollectional(final Class type)
  6. isCollectionOrArray(final Class cls)
  7. isCollectionOrArray(final Object obj)
  8. isCollectionOrArrayType(Class typeToCheck)
  9. isCollectionType(Class aClass)