Here you can find the source of arrayComponentClassFromArray(T[] arg)
Parameter | Description |
---|---|
arg | the array |
T | parameterizes the array |
@SuppressWarnings(value = { "unchecked" }) public static <T> Class<T> arrayComponentClassFromArray(T[] arg)
//package com.java2s; // compliance with the InfoGrid license. The InfoGrid license and important public class Main { /**// w w w . j a va 2 s.c o m * Helper method to create an arrayComponentType from the componentType of an array * that's provided. * * @param arg the array * @return the component type of the array * @param <T> parameterizes the array */ @SuppressWarnings(value = { "unchecked" }) public static <T> Class<T> arrayComponentClassFromArray(T[] arg) { return (Class<T>) arg.getClass().getComponentType(); } }