public static <T> T[] convertListToArray(List<?> oids, Class<T> clazz) {
        T[] resultArray = (T[]) Array.newInstance(clazz, oids.size());

        return oids.toArray(resultArray);
    }
public static < T > T [ ] convertListToArray ( List < ? > oids , Class < T > clazz ) { T [ ] resultArray = ( T [ ] ) Array . newInstance ( clazz , oids . size ( ) ) ; return oids . toArray ( resultArray ) ; }
@param <T> type of result array.
@param oids source list of elements.
@param clazz source class of result array.
@return resulting array.