Here you can find the source of toArray(List list)
public static String[] toArray(List list)
//package com.java2s; import java.util.List; import java.util.Set; public class Main { public static String[] toArray(List list) { return (String[]) list.toArray(new String[list.size()]); }//from w w w . java 2 s . c om public static String[] toArray(Set set) { return (String[]) set.toArray(new String[set.size()]); } }