Java Utililty Methods Array to List

List of utility methods to do Array to List

Description

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

Method

ListtoList(E... values)
Create List
List<E> list = null;
if (values != null && values.length > 0) {
    list = new ArrayList<E>(values.length);
    for (E obj : values) {
        list.add(obj);
return list;
...
ListtoList(E[] array, int fromIndex, int toIndex)
to List
List<E> list = Arrays.asList(array);
return list.subList(fromIndex, toIndex);
ListtoList(final double[] array)
to List
List<Double> list = new ArrayList<Double>(array.length);
for (int i = 0; i < array.length; i++) {
    list.add(array[i]);
return list;
ListtoList(final E[] array)
to List
List<E> list = new ArrayList<E>(array.length);
for (E e : array) {
    list.add(e);
return list;
ListtoList(final float[] array)
to List
Float[] v = toObject(array);
return Arrays.asList(v);
ListtoList(final int[] array)
to List
final List<Integer> list = new ArrayList<>();
for (final int value : array) {
    list.add(Integer.valueOf(value));
return list;
ListtoList(final int[] array)
Convert an array of int to a list of Integers
if (array == null)
    return null;
final ArrayList<Integer> result = new ArrayList<Integer>(array.length);
for (int i = 0; i < array.length; i++)
    result.add(Integer.valueOf(array[i]));
return result;
ListToList(final Object[] array)
To List
return Arrays.asList(array);
ListtoList(final Object[] objects)
to List
final List<T> list = new ArrayList<T>();
for (final Object o : objects) {
    list.add((T) o);
return list;
ListtoList(final T... objects)
To list.
return list(objects);