@ SuppressWarnings ( "unchecked" ) public static < T > T [ ] toArray ( List list , Class < T > tClass ) { Object arrayObject = Array . newInstance ( tClass , list . size ( ) ) ; for ( int i = 0 ; i < list . size ( ) ; i ++ ) { Array . set ( arrayObject , i , list . get ( i ) ) ; } return ( T [ ] ) arrayObject ; }
convert list to an array .