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(@SuppressWarnings("unchecked") T... ts)
to List
return Arrays.asList(ts);
ListtoList(boolean... booleans)
to List
List<Boolean> list = new ArrayList<>();
for (boolean b : booleans) {
    list.add(b);
return list;
ListtoList(boolean[] array)
to List
if ((array == null) || (array.length == 0)) {
    return new ArrayList<Boolean>();
List<Boolean> list = new ArrayList<Boolean>(array.length);
for (boolean value : array) {
    list.add(value);
return list;
...
ListtoList(boolean[] array)
to List
if ((array == null) || (array.length == 0)) {
    return Collections.EMPTY_LIST;
List<Boolean> list = new ArrayList<Boolean>(array.length);
for (boolean value : array) {
    list.add(value);
return list;
...
ListtoList(Boolean[] list)
to List
if ((list == null) || (list.length == 0)) {
    return Collections.EMPTY_LIST;
List<Boolean> newList = new ArrayList<Boolean>(list.length);
for (Boolean value : list) {
    newList.add(value);
return newList;
...
ListtoList(byte[] array)
Turns the byte array into a Byte list.
ArrayList<Byte> result;
result = new ArrayList<>();
for (byte element : array)
    result.add(element);
return result;
ListtoList(byte[] array)
to List
if (array == null) {
    return null;
List<Byte> list = new ArrayList<Byte>(array.length);
for (byte value : array) {
    list.add(value);
return list;
...
ListtoList(double[] array)
Converts from a double array to a list.
List<Double> list = new ArrayList<Double>();
for (int i = 0; i < array.length; i++)
    list.add(array[i]);
return list;
ArrayListtoList(double[] array)
to List
ArrayList<Double> result = new ArrayList<Double>();
for (double d : array) {
    result.add(d);
return result;
ListtoList(E... e)
to List
return Arrays.asList(e);