List of utility methods to do Array to List Convert
List | arrayToList(T[] array) array To List final ArrayList<T> list = new ArrayList<T>(array.length); for (final T i : array) list.add(i); return list; |
List | asList(T... args) as List ArrayList<T> rv = new ArrayList<T>(); for (T a : args) { rv.add(a); return rv; |
List | asList(T... vals) as List ArrayList<T> result = new ArrayList<T>(); for (T i : vals) result.add(i); return result; |
List | asList(char[] array) as List List<Character> list = new ArrayList<Character>(array.length); for (int i = 0; i != array.length; ++i) list.add(array[i]); return list; |
List | asList(int[] array) as List List<Integer> list = new ArrayList<Integer>(array.length); for (int i = 0; i != array.length; ++i) list.add(array[i]); return list; |
List | asList(int[] intArray) Converts an array of int into a List of Integer . List<Integer> res = new ArrayList<Integer>(intArray.length); for (int i : intArray) { res.add(i); return res; |
List | asList(long[] longArray) Converts an array of long into a List of Long . List<Long> res = new ArrayList<Long>(longArray.length); for (long i : longArray) { res.add(i); return res; |
ArrayList | convertArrayToList(T[] array) convert Array To List ArrayList<T> ret = new ArrayList<T>(array.length); for (T t : array) { ret.add(t); return ret; |
List | listOf(final T... items) list Of return Collections.unmodifiableList(Arrays.asList(items));
|
ArrayList | newArrayList(E... elements) new Array List ArrayList<E> list = new ArrayList<E>(elements.length); Collections.addAll(list, elements); return list; |