private static Object checkComponentType ( Object array , Class < ? > expectedComponentType ) { Class < ? > actualComponentType = array . getClass ( ) . getComponentType ( ) ; if ( ! expectedComponentType . isAssignableFrom ( actualComponentType ) ) { throw new ArrayStoreException ( String . format ( "The expected component type %s is not assignable from the actual type %s" , expectedComponentType . getCanonicalName ( ) , actualComponentType . getCanonicalName ( ) ) ) ; } return array ; }
Checks the component type of the given array against the expected component type .