List of utility methods to do List to Array
int[] | asArray(Collection as Array final int[] result = new int[list.size()]; int index = 0; for (Integer integer : list) { result[index++] = integer; return result; |
double[] | asArray(List as Array double[] array = new double[values.size()]; for (int i = 0; i < values.size(); i++) { array[i] = values.get(i); return array; |
int[] | asArray(List as Array int[] _indices = new int[indices.size()]; for (int i = 0; i < indices.size(); i++) _indices[i] = indices.get(i); return _indices; |
String[] | asArray(List as Array if (null == list) { return null; String[] res = new String[list.size()]; list.toArray(res); return res; |
T[] | asArray(List Converts a list to an array of the same type. return (T[]) list.toArray();
|
ArrayList | asArrayList(E first, E... other) as Array List if (other == null) { throw new NullPointerException("other"); ArrayList<E> list = new ArrayList<>(1 + other.length); list.add(first); list.addAll(Arrays.asList(other)); return list; |
ArrayList | asArrayList(T... a) as Array List return new ArrayList<T>(Arrays.asList(a)); |
boolean[] | asBooleanArray(List as Boolean Array int n = list.size(); boolean[] array = new boolean[n]; for (int i = 0; i < n; i++) { array[i] = list.get(i); return array; |
byte[] | asByteArray(final List Return list of boxed bytes as a primitive array. final byte[] a = new byte[l.size()]; for (int i = 0; i < a.length; i++) { a[i] = l.get(i); return a; |
Class>[] | asClassArray(List as Class Array Class<?>[] asArray = new Class[list.size()]; int i = 0; for (Class<?> t : list) { asArray[i++] = t; return asArray; |