Java Collection to Array toClassArray(Collection> collection)

Here you can find the source of toClassArray(Collection> collection)

Description

Copy the given Collection into a Class array.

License

Open Source License

Parameter

Parameter Description
collection the Collection to copy

Return

the Class array ( null if the passed-in Collection was null )

Declaration

public static Class<?>[] toClassArray(Collection<Class<?>> collection) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.Collection;

public class Main {
    /**/*from   w  w w  . ja  v a 2  s  .c  om*/
     * Copy the given Collection into a Class array.
     * The Collection must contain Class elements only.
     * @param collection the Collection to copy
     * @return the Class array ({@code null} if the passed-in
     * Collection was {@code null})
     */
    public static Class<?>[] toClassArray(Collection<Class<?>> collection) {
        if (collection == null) {
            return null;
        }
        return collection.toArray(new Class<?>[collection.size()]);
    }
}

Related

  1. toBaseTypedCollection(Collection initial)
  2. toByteArray(Collection c)
  3. toByteArray(Collection c)
  4. toCharArray(Collection source)
  5. toCharArray(Collection patterns)
  6. toClassArray(Collection> collection)
  7. toClassArray(final Collection collection)
  8. toDouble(final Collection numbers)
  9. toDoubleArray(Collection items)