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 E... array)
Wraps the given array into a fixed-size List of the given array type.
return Arrays.asList(array);
ListasList(final int... values)
Returns a List List<Integer> representation of an primitive int array.
if (values == null)
    throw new IllegalArgumentException("the input array cannot be null");
return new AbstractList<Integer>() {
    @Override
    public Integer get(final int index) {
        return values[index];
    @Override
...
ListasList(final int[] a)
takes an int array and returns a List of Integer backed by the array
return new AbstractList<Integer>() {
    public Integer get(int i) {
        return a[i];
    public Integer set(int i, Integer val) {
        Integer oldVal = a[i];
        a[i] = val;
        return oldVal;
...
ListasList(final int[] a)
A List of Integer from an array of int.
return new AbstractList<Integer>() {
    public Integer get(int i) {
        return a[i];
    public Integer set(int i, Integer val) {
        Integer oldVal = a[i];
        a[i] = val;
        return oldVal;
...
ListasList(final Iterable iterable)
as List
return (iterable instanceof Collection) ? new LinkedList<T>((Collection<? extends T>) iterable)
        : new LinkedList<T>() {
            private static final long serialVersionUID = 3109256773218160485L;
                if (iterable != null) {
                    for (final T t : iterable) {
                        add(t);
        };
ListasList(final Iterable iterable)
Converts Iterable to List .
final ArrayList<T> list = new ArrayList<>();
iterable.forEach(input -> list.add(input));
return list;
ListasList(final long[] ids)
as List
return asList(ids, 0, ids.length);
ListasList(final Object array)
as List
if (array instanceof Object[]) {
    final Object[] arrayCasted = (Object[]) array;
    final List<Object> result = new ArrayList<Object>(arrayCasted.length);
    Collections.addAll(result, arrayCasted);
    return result;
if (array instanceof byte[]) {
    final byte[] arrayCasted = (byte[]) array;
...
ListasList(final Object[] arguments)
as List
return arguments != null ? Arrays.asList(arguments) : Collections.emptyList();
ListasList(final Object[] array)
Returns a fixed-size list backed by the specified array.
return Arrays.asList(array);