Here you can find the source of toStringArray(List
public static String[] toStringArray(List<String> list)
//package com.java2s; //License from project: Apache License import java.util.List; public class Main { public static String[] toStringArray(List<String> list) { String[] data = new String[list.size()]; for (int i = 0; i < data.length; i++) data[i] = list.get(i);/*from ww w. j av a2s . c o m*/ return data; } public static <T> T get(List<T> l, int i) { return get(l, i, null); } public static <T> T get(List<T> l, int i, T defValue) { if (i < 0) i += l.size(); if (i < 0 || i >= l.size()) return defValue; return l.get(i); } public static <T> T get(T[] l, int i) { return get(l, i, null); } public static <T> T get(T[] l, int i, T defValue) { if (i < 0) i += l.length; if (i < 0 || i >= l.length) return defValue; return l[i]; } public static double get(double[] l, int i, double defValue) { if (i < 0) i += l.length; if (i < 0 || i >= l.length) return defValue; return l[i]; } }