Java Utililty Methods List to Array

List of utility methods to do List to Array

Description

The list of methods to do List to Array are organized into topic(s).

Method

Object[]toObjectArray(List list)
to Object Array
Object[] array = new Object[list.size()];
for (int i = 0; i < array.length; i++)
    array[i] = list.get(i);
return array;
Object[]toObjectArray(List list)
to Object Array
Object[] array = new Object[list.size()];
for (int i = 0; i < list.size(); i++) {
    Object value = list.get(i);
    if (value instanceof List) {
        value = toObjectArray((List<Object>) value);
    array[i] = value;
return array;
Object[]toObjectArrayNative(List L)
to Object Array Native
if (L == null)
    return null;
return L.toArray(new Object[L.size()]);
String[]toStringArray(final List stringList)
to String Array
return (String[]) stringList.toArray(new String[stringList.size()]);
String[]toStringArray(final List list)
to String Array
return toStringArray(list, null);
String[]toStringArray(List l)
_more_
String[] a = new String[l.size()];
for (int i = 0; i < l.size(); i++) {
    Object o = l.get(i);
    if (o == null) {
        a[i] = null;
    } else {
        a[i] = o.toString();
return a;
String[]toStringArray(List list)
cast all Elememts of a list to a String array, make simple cast of the object by toString method
int i = list.size();
String[] arr = new String[i];
for (i--; i >= 0; i--) {
    arr[i] = list.get(i).toString();
return arr;
String[]toStringArray(List list)
to String Array
if (isEmpty(list)) {
    return null;
String[] fields = new String[list.size()];
int index = 0;
for (Integer num : list) {
    fields[index] = Integer.toString(num);
    index++;
...
String[]toStringArray(List objList)
to String Array
String ret[] = new String[objList.size()];
for (int i = 0; i < objList.size(); i++)
    ret[i] = objList.get(i).toString();
return ret;
String[]toStringArray(List array)
to String Array
return array.toArray(new String[] {});