@SuppressWarnings("unchecked")
    public static <T> T[] toArray( List<?> list, Class<T> type )
    {
        T[] array = (T[])Array.newInstance( type, list.size() );
        return list.toArray( array );
    }
@ SuppressWarnings ( "unchecked" ) public static < T > T [ ] toArray ( List < ? > list , Class < T > type ) { T [ ] array = ( T [ ] ) Array . newInstance ( type , list . size ( ) ) ; return list . toArray ( array ) ; }
<p>toArray.</p>

@param list a {@link java.util.List} object.
@param type a {@link java.lang.Class} object.
@param <T> a T object.
@return an array of T objects.