Java Utililty Methods List from Array

List of utility methods to do List from Array

Description

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

Method

CollectionasList(int... data)
as List
ArrayList<Integer> list = new ArrayList<Integer>(data.length);
for (int i : data)
    list.add(i);
return list;
ListasList(int... values)
as List
int len = length(values);
if (len <= 0) {
    return Collections.emptyList();
List<Integer> l = new ArrayList<>(len);
for (int v : values) {
    l.add(v);
return l;
ListasList(int[] a)
as List
List<Integer> result = new ArrayList<Integer>(a.length);
for (int i = 0; i < a.length; i++) {
    result.add(Integer.valueOf(a[i]));
return result;
ListasList(int[] ai)
as List
final List<Integer> result = new ArrayList<Integer>(ai.length);
for (int i : ai) {
    result.add(i);
assert result.size() == ai.length;
return result;
ListasList(int[] ar)
as List
List<Integer> list = new ArrayList<Integer>(ar.length);
for (int a : ar)
    list.add(a);
return list;
ListasList(int[] arr)
as List
Integer[] arrObj = new Integer[arr.length];
for (int i = 0; i < arr.length; i++) {
    arrObj[i] = arr[i];
return Arrays.asList(arrObj);
ListasList(int[] ints)
as List
List list = new ArrayList();
for (int i = 0; i < ints.length; i++) {
    list.add(i, ints[i]);
return list;
ListasList(int[] list)
Converts an array of primitives to a list of Integers.
if (list == null) {
    return null;
List<Integer> ilist = new ArrayList<Integer>(list.length);
for (int ii = 0; ii < list.length; ii++) {
    ilist.add(list[ii]);
return ilist;
...
ArrayListasList(int[] values)
as List
if (values == null) {
    return null;
ArrayList<Integer> list = new ArrayList<Integer>(values.length);
for (int i = 0; i < values.length; i++) {
    list.add(new Integer(values[i]));
return list;
...
ListasList(Iterable iterable)
Returns all elements from the given iterable as a list
List<T> list = new ArrayList<T>();
addAll(iterable, list);
return list;