src/main/java/org/eiichiro/bootleg/Types.java
public static Class<?> getElementType(Type type) {
		if (isCollection(type)) {
			if (type instanceof ParameterizedType) {
				ParameterizedType parameterizedType = (ParameterizedType) type;
				return (Class<?>) parameterizedType.getActualTypeArguments()[0];
			} else {
				return Object.class;
			}
			
		} else if (isArray(type)) {
			if (type instanceof GenericArrayType) {
				GenericArrayType genericArrayType = (GenericArrayType) type;
				return (Class<?>) genericArrayType.getGenericComponentType();
			} else {
				Class<?> clazz = (Class<?>) type;
				return clazz.getComponentType();
			}
			
		} else {
			throw new IllegalArgumentException("'type' must be a collection or array");
		}
	}
public static Class<?> getElementType(Type type) {
		if (isCollection(type)) {
			if (type instanceof ParameterizedType) {
				ParameterizedType parameterizedType = (ParameterizedType) type;
				return (Class<?>) parameterizedType.getActualTypeArguments()[0];
			} else {
				return Object.class;
			}
			
		} else if (isArray(type)) {
			if (type instanceof GenericArrayType) {
				GenericArrayType genericArrayType = (GenericArrayType) type;
				return (Class<?>) genericArrayType.getGenericComponentType();
			} else {
				Class<?> clazz = (Class<?>) type;
				return clazz.getComponentType();
			}
			
		} else {
			throw new IllegalArgumentException("'type' must be a collection or array");
		}
	}
public static Class < ? > getElementType ( Type type ) { if ( isCollection ( type ) ) { if ( type instanceof ParameterizedType ) { ParameterizedType parameterizedType = ( ParameterizedType ) type ; return ( Class < ? > ) parameterizedType . getActualTypeArguments ( ) [ 0 ] ; } else { return Object . class ; } } else if ( isArray ( type ) ) { if ( type instanceof GenericArrayType ) { GenericArrayType genericArrayType = ( GenericArrayType ) type ; return ( Class < ? > ) genericArrayType . getGenericComponentType ( ) ; } else { Class < ? > clazz = ( Class < ? > ) type ; return clazz . getComponentType ( ) ; } } else { throw new IllegalArgumentException ( "'type' must be a collection or array" ) ; } }
Returns the element type of the specified collection type.
The specified type must be collection or array. To make it sure, use
{@code #isCollection(Type)} method or {@code #isArray(Type)} method.

@param type Collection or array type.
@return The element type of the specified collection or array.
@throws IllegalArgumentException If the specified 'type' is not a
collection or array.
Returns the element type of the specified collection type . The specified type must be collection or array . To make it sure use { @code #isCollection ( Type ) } method or { @code #isArray ( Type ) } method .