Here you can find the source of listToArray(List list)
@SuppressWarnings("unchecked") public static String[] listToArray(List list)
//package com.java2s; //License from project: Apache License import java.util.*; public class Main { @SuppressWarnings("unchecked") public static String[] listToArray(List list) { final int size = list.size(); String[] str = (String[]) list.toArray(new String[size]); return str; }//from w w w. j a va2 s . c o m }