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

String[]toStringArray(List items)
to String Array
if (items == null)
    return new String[] {};
String[] arr = new String[items.size()];
for (int i = 0; i < items.size(); i++) {
    arr[i] = items.get(i);
return arr;
String[]toStringArray(List list)
to String Array
return list.toArray(new String[0]);
String[]toStringArray(List list)
to String Array
String[] data = new String[list.size()];
for (int i = 0; i < data.length; i++)
    data[i] = list.get(i);
return data;
String[]toStringArray(List list)
to String Array
return list.toArray(new String[list.size()]);
String[]toStringArraySafe(List list)
to String Array Safe
while (list.contains(null)) {
    list.remove(null);
return ((List<String>) list).toArray(new String[list.size()]);