Java Utililty Methods List to Int List

List of utility methods to do List to Int List

Description

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

Method

int[]toIntArray(List list)
Converts the argument to an int[] array.
final int[] array = new int[list.size()];
for (int i = 0; i < array.length; i++)
    array[i] = ((Integer) list.get(i)).intValue();
return array;
int[]toIntArray(List nums)
Convert a List of Number objects to an int array.
int[] result = new int[nums.size()];
Iterator iter;
int i;
for (i = 0, iter = nums.iterator(); iter.hasNext(); i++) {
    Number num = (Number) iter.next();
    result[i] = num.intValue();
return result;
...
int[]toIntArray(List ints)
to Int Array
int[] result = new int[ints.size()];
int i = 0;
for (Number j : ints) {
    result[i] = j.intValue();
    i++;
return result;
ArrayListtoIntArray(List bytes)
Coverts a data stream represented as an array of bytes to an array of integers.
if (bytes.size() % 4 != 0) {
    throw new IllegalArgumentException(
            "Integer Array can only be created from byte arrays where size%4 is 0");
ArrayList<Integer> integers = new ArrayList<Integer>();
for (int index = 0; index < bytes.size(); index += 4) {
    integers.add(
            new Integer(((bytes.get(index) << 24) & 0xff000000) | ((bytes.get(index + 1) << 16) & 0xff0000)
...
int[]toIntArray(List a)
to Int Array
int[] d = new int[a.size()];
for (int i = 0; i < d.length; ++i) {
    d[i] = a.get(i);
return d;
int[]toIntArray(List integerList)
to Int Array
if (integerList == null)
    return null;
int[] intArray = new int[integerList.size()];
for (int i = 0; i < integerList.size(); i++) {
    intArray[i] = integerList.get(i);
return intArray;
int[]toIntArray(List intList)
Convert a List into the primitive type array
assert intList != null;
if (intList == null) {
    return null;
int[] ints = new int[intList.size()];
for (int i = 0; i < intList.size(); i++) {
    ints[i] = intList.get(i);
return ints;
int[]toIntArray(List list)
to Int Array
int[] array = new int[list.size()];
for (int i = 0; i < array.length; i++)
    array[i] = list.get(i);
return array;
int[]toIntArray(List list)
Converts a List with Integer objects to a primary type int array
if (list == null)
    return null;
int[] arr = new int[list.size()];
int i = 0;
for (Integer v : list)
    arr[i++] = v;
return arr;
int[]toIntArray(List list)
to Int Array
int[] array = new int[list.size()];
Iterator<Integer> ints = list.iterator();
int idx = 0;
while (ints.hasNext()) {
    Integer value = ints.next();
    array[idx++] = value.intValue();
return array;
...