Here you can find the source of toArray(final Collection
public static final String[] toArray(final Collection<String> collection)
//package com.java2s; //License from project: LGPL import java.util.Collection; public class Main { public static final String[] toArray(final Collection<String> collection) { if (collection == null) return null; final String[] a = new String[collection.size()]; collection.toArray(a);// ww w . j av a 2 s . c o m return a; } }