Java Utililty Methods ArrayList to Array

List of utility methods to do ArrayList to Array

Description

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

Method

int[]toArray(ArrayList arrlist)
to Array
int[] arr = new int[arrlist.size()];
for (int i = 0; i < arrlist.size(); i++)
    arr[i] = arrlist.get(i);
return arr;
String[]toArray(ArrayList sigs)
to Array
int size = sigs.size();
if (size == 0) {
    return new String[0];
Iterator<String> it = sigs.iterator();
String[] result = new String[size];
for (int j = 0; j < size; j++) {
    result[j] = it.next();
...
boolean[]toBooleanArray(ArrayList items)
to Boolean Array
boolean[] result = new boolean[items.size()];
for (int i = 0; i < items.size(); i++)
    result[i] = ((Boolean) items.get(i)).booleanValue();
return result;
byte[]toByteArray(ArrayList in)
to Byte Array
int n = in.size();
byte ret[] = new byte[n];
for (int x = 0; x < n; x++) {
    ret[x] = in.get(x);
return ret;
int[]toIntArray(ArrayList list)
to Int Array
int[] result = new int[list.size()];
for (int i = 0; i < list.size(); i++) {
    Number n = (Number) list.get(i);
    result[i] = n.intValue();
return result;
int[]toIntArray(ArrayList array)
to Int Array
Integer[] temp = new Integer[array.size()];
int[] out = new int[array.size()];
temp = array.toArray(temp);
for (int i = 0; i < array.size(); i++) {
    out[i] = temp[i];
return out;
int[]toIntArray(ArrayList array)
Convert an array of Integers into an array of ints.
int[] intArray = new int[array.size()];
Iterator it = array.iterator();
int index = 0;
while (it.hasNext()) {
    intArray[index] = ((Integer) it.next()).intValue();
    index++;
return intArray;
...
int[]toIntArray(ArrayList input)
Convert an ArrayList to a simple Array
int len = input.size();
int[] output = new int[len];
for (int i = 0; i < len; i++) {
    output[i] = input.get(i);
return output;
String[]toStringArr(ArrayList al)
to String Arr
return (String[]) al.toArray(stringArr);
String[]toStringArray(ArrayList src)
Parses ArrayList<String> into String[].
String[] ret = new String[src.size()];
return src.toArray(ret);