Java Char Array Create toClasses(Object[] args)

Here you can find the source of toClasses(Object[] args)

Description

From a list of objects, extracts a list of corresponding classes.

License

Open Source License

Parameter

Parameter Description
args An arbitrary list of objects

Return

A list that for each input object contains the corresponding class.

Declaration

@SuppressWarnings("rawtypes")
public static final Class[] toClasses(Object[] args) 

Method Source Code

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

public class Main {
    /**/* w w  w.  j ava  2  s. co  m*/
     * From a list of objects, extracts a list of corresponding classes.
     * @param args An arbitrary list of objects
     * @return A list that for each input object contains the corresponding class.
     */
    @SuppressWarnings("rawtypes")
    public static final Class[] toClasses(Object[] args) {
        if (args.length <= 0)
            return new Class[0];
        Class[] value = new Class[args.length];
        int iter = 0;
        for (Object A : args) {
            value[iter] = A.getClass();
            iter++;
        }
        return value;
    }
}

Related

  1. toClassArray(final Object[] args)
  2. toClassArray(Object[] params)
  3. toClassArray(String[] classNames)
  4. toClasses(ClassLoader classLoader, String[] argClassNames)
  5. toClasses(final Object... parameters)
  6. toClasses(Object[] objs)
  7. toClassesFromObjects(final Object[] params)