public static Object[] toArray(List list)
    {
        Object[] result;
        int size = list.size();

        if (size == 0) {
            result = NoArguments;
        } else {
            result = getObjectArrayPool().create(list.size());
            for (int i = 0; i < size; i++) {
                result[i] = list.get(i);
            }
        }
        return result;
    }
public static Object [ ] toArray ( List list ) { Object [ ] result ; int size = list . size ( ) ; if ( size == 0 ) { result = NoArguments ; } else { result = getObjectArrayPool ( ) . create ( list . size ( ) ) ; for ( int i = 0 ; i < size ; i ++ ) { result [ i ] = list . get ( i ) ; } } return result ; }
Utility to convert a List into an Object[] array. If the list is zero elements this will
return a constant array; toArray() on List always returns a new object and this is wasteful
for our purposes.