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

ListasList(final Object[] objectArray)
as List
final List<Object> list = new ArrayList<Object>();
for (final Object element : objectArray) {
    if (Collection.class.isAssignableFrom(element.getClass())) {
        @SuppressWarnings("rawtypes")
        final Collection collection = (Collection) element;
        list.addAll(asList(collection.toArray()));
    } else {
        list.add(element);
...
ListasList(final Set elements)
Returns the elements of the given set as list.
final List<T> elementList = new ArrayList<T>();
elementList.addAll(elements);
return elementList;
ListasList(final T node)
as List
if (node == null) {
    return Collections.emptyList();
return Collections.singletonList(node);
ListasList(final T... array)
Returns the specified array as a List of elements.
List<T> arrayList = new ArrayList<T>(array.length);
Collections.addAll(arrayList, array);
return arrayList;
ArrayListasList(final T... data)
Returns data converted into list.
final ArrayList<T> list = new ArrayList<T>(data.length);
Collections.addAll(list, data);
return list;
ListasList(final T... data)
Returns data converted into list.
final List<T> list = new ArrayList<T>(data.length);
Collections.addAll(list, data);
return list;
ListasList(final T[] array)
Converts the given array to a List.
List<T> res;
if (isEmpty(array)) {
    res = Collections.emptyList();
} else {
    res = Arrays.asList(array);
return res;
ListasList(final T[] input)
Return an ArrayList.
final List<T> out = new ArrayList<T>(input.length);
for (int i = 0; i < input.length; i++) {
    out.add(input[i]);
return out;
ListasList(float[] elements)
Converts an array of float numbers to a list of Float s.
int size = (elements != null) ? elements.length : 0;
List<Float> list = new ArrayList<Float>(size);
if (elements != null) {
    for (Float elem : elements) {
        list.add(elem);
return list;
...
ListasList(int... array)
Returns a list given the argument array.
List<Integer> list = new ArrayList<>();
for (int element : array) {
    list.add(element);
return list;