Here you can find the source of convertListToStrArray(List list)
List
to an String array.
Parameter | Description |
---|---|
list | a <code>List</code> |
public static String[] convertListToStrArray(List list)
//package com.java2s; // are made available under the terms of the Eclipse Public License v1.0 import java.util.List; public class Main { /**/*from w w w.j a v a2 s. c om*/ * Converts a <code>List</code> to an String array. * * @param list * a <code>List</code> * @return a String array */ public static String[] convertListToStrArray(List list) { if (list != null) { int cnt = list.size(); String[] strArray = new String[cnt]; for (int i = 0; i < cnt; i++) { String str = (String) list.get(i); strArray[i] = new String(str); } return strArray; } else { return null; } } }