static Object[] toArray(Collection<?> coll) {
    	Object[] values = coll.toArray();
    	// as in ArrayList: toArray() might (incorrectly) not return Object[] (see bug 6260652)
    	if (values.getClass() != Object[].class) {
    		values = Arrays.copyOf(values, values.length, Object[].class);
	    }
    	return values;
	}
Copies the collection values into an array.

@param coll   collection of values
@return       array containing the collection values
jphp-runtime/src/php/runtime/memory/support/IList.java