Java List to String convertListToStrArray(List list)

Here you can find the source of convertListToStrArray(List list)

Description

Converts a List to an String array.

License

Open Source License

Parameter

Parameter Description
list a <code>List</code>

Return

a String array

Declaration

public static String[] convertListToStrArray(List list) 

Method Source Code

//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;
        }
    }
}

Related

  1. asStringList( Collection objects)
  2. asStringList(Collection list)
  3. asStringList(Collection objects)
  4. asStringList(List coll)
  5. asStringList(Set attributes)
  6. convertListToString(Iterable l)
  7. convertListToString(List list)
  8. convertListToString(List list, String delimiter, char encloser)
  9. convertListToString(List list)