List of utility methods to do List to Array
Double[] | toArray(List to Array return values.toArray(new Double[values.size()]); |
String[] | toArray(List Converts a list of enumerations to an array of their Enum#toString() representation String[] out = new String[enums.size()]; for (int i = 0; i < out.length; i++) { out[i] = enums.get(i).toString(); return out; |
int[] | toArray(List Copy the given List to the specified Array at offset zero. if (to == null || to.length < from.size()) { to = new int[from.size()]; int i = 0; for (Integer element : from) { to[i++] = element; return to; ... |
int[] | toArray(List Returns the non-null integers in the given list as an array. if (l == null) { return null; int count = 0; for (Integer e : l) { if (e != null) { count++; int[] result = new int[count]; int i = 0; for (Integer e : l) { if (e != null) { result[i++] = e; return result; |
int[] | toArray(List to Array int[] ret = new int[list.size()]; int i = 0; for (Integer e : list) { ret[i++] = e.intValue(); return ret; |
int[] | toArray(List Converts a list of integers to an array int[] array = new int[list.size()]; for (int i = 0, l = list.size(); i < l; i++) array[i] = list.get(i); return array; |
int[] | toArray(List to Array int[] result = new int[list.size()]; int index = 0; for (Integer number : list) { result[index++] = number; return result; |
List | toLongList(String str, String splitStr) to Long List if (str != null) { ArrayList<Long> longList = new ArrayList<Long>(); String[] strList = str.split(splitStr); for (String string : strList) { longList.add(Long.parseLong(string)); return longList; return null; |
List | toLongList(String[] array) Converts a String array to a long array. List<Long> out = new ArrayList<Long>(array.length); for (int i = 0; i < array.length; i++) { if (array[i] == null) throw new RuntimeException("Null value in position " + i); out.add(Long.parseLong(array[i])); return out; |
Object[] | toObjectArray(List
to Object Array List<String[]> output = new ArrayList<>(); for (List<String> l : lists) { output.add(l.toArray(new String[0])); return output.toArray(); |