Here you can find the source of toArray(Collection> collection)
public static Object[] toArray(Collection<?> collection)
//package com.java2s; //License from project: Apache License import java.util.Collection; public class Main { public static Object[] toArray(Collection<?> collection) { return collection.toArray(new Object[collection.size()]); }/* w w w.j av a 2s . co m*/ public static <E> E[] toArray(Collection<E> collection, E[] array) { return collection.toArray(array); } }