Java List to Array toStringArray(List list)

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

Description

cast all Elememts of a list to a String array, make simple cast of the object by toString method

License

LGPL

Parameter

Parameter Description
list List to cast to a String Array

Return

String array from List

Declaration

public static String[] toStringArray(List list) 

Method Source Code

//package com.java2s;
//License from project: LGPL 

import java.util.List;

public class Main {
    /**/*from   w ww . j  a  v a  2 s  .c o m*/
     * cast all Elememts of a list to a String array, make simple cast of the object by toString method
     * @param list List to cast to a String Array
     * @return String array from List
     */
    public static String[] toStringArray(List list) {
        int i = list.size();
        String[] arr = new String[i];
        for (i--; i >= 0; i--) {
            arr[i] = list.get(i).toString();
        }
        return arr;
    }
}

Related

  1. toObjectArray(List list)
  2. toObjectArrayNative(List L)
  3. toStringArray(final List stringList)
  4. toStringArray(final List list)
  5. toStringArray(List l)
  6. toStringArray(List list)
  7. toStringArray(List objList)
  8. toStringArray(List array)
  9. toStringArray(List items)

  10. HOME | Copyright © www.java2s.com 2016