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[]toIntegerArray(List arrayValues)
to Integer Array
int length = arrayValues.size();
int[] result = new int[length];
for (int i = 0; i < length; i++) {
    result[i] = (int) arrayValues.get(i);
return result;
int[]toIntegerArray(List values)
Creates an array of type int[] from a list of instances of class Integer.
int ret[] = new int[values.size()];
for (int i = 0; i < ret.length; i++)
    ret[i] = values.get(i);
return ret;
ListtoIntegerList(final E[] array)
to Integer List
List<Integer> integerList = null;
if (array != null) {
    integerList = new ArrayList<Integer>(array.length);
    for (E e : array) {
        if (e != null) {
            try {
                integerList.add(Integer.parseInt(e.toString()));
            } catch (NumberFormatException nfe) {
...
ListtoIntegerList(int... array)
to Integer List
List<Integer> list = new ArrayList<>(array.length);
for (int item : array)
    list.add(item);
return list;
ListtoIntegerList(int[] array)
to Integer List
List<Integer> list = new ArrayList<Integer>(array.length);
for (int el : array)
    list.add(el);
return list;
ListtoIntegerList(int[] intArray)
Convert the given int array to an integer list
List<Integer> integerList = new ArrayList<Integer>(intArray.length);
for (int currInt : intArray) {
    integerList.add(currInt);
return integerList;
ListtoIntegerList(List strList, boolean failOnException)
Parse a list of String into a list of Integer.
List<Integer> intList = new ArrayList<Integer>();
for (String str : strList) {
    try {
        intList.add(Integer.parseInt(str));
    } catch (NumberFormatException nfe) {
        if (failOnException) {
            return null;
        } else {
...
ListtoIntegers(final List longs)
Converts a list of Longs to Integers
final List<Integer> ints = new ArrayList<>();
for (final Long lng : longs) {
    ints.add(lng.intValue());
return ints;
ListtoIntegers(List values)
to Integers
if (values == null) {
    return null;
List<Integer> integerValues = new ArrayList<Integer>(values.size());
for (int index = 0; index < values.size(); index++) {
    String value = values.get(index);
    Integer integerValue = toInteger(value);
    integerValues.add(integerValue);
...
ListtoIntList(List list)
to Int List
List<Integer> result = new ArrayList<Integer>();
for (String str : list) {
    result.add(fromIntString(str));
return result;