List of utility methods to do List from Array
ArrayList | arrayToList(int[] a) make an Array of the type int[] into ArrayList ArrayList<Integer> ret = new ArrayList<Integer>(); for (int i = 0; i < a.length; i++) { ret.add(a[i]); return ret; |
List | arrayToList(int[] array) arrayToList converts an int array to an ArrayList object, then sorts it in descending order. List<Integer> al = new ArrayList<Integer>(); for (int i : array) { al.add(i); Collections.sort(al, new Comparator<Integer>() { public int compare(Integer o1, Integer o2) { if (o1 > (int) o2) { return -1; ... |
ArrayList | arrayToList(int[] array) array To List if (isEmpty(array)) { return null; ArrayList<Integer> result = new ArrayList<Integer>(); for (int num : array) { result.add(num); return result; ... |
List | arrayToList(Object arr[], int from, int length) array To List if (arr == null) return null; List<Object> list = new ArrayList<Object>(); for (int i = from; i < length; i++) list.add(arr[i]); return list; |
List | arrayToList(Object data) array To List ArrayList<Object> list = new ArrayList<Object>(); if (data instanceof Object[]) { Object[] o = (Object[]) data; for (Object object : o) { list.add(object); } else if (data instanceof Collection) { Collection tmp = (Collection) data; ... |
List | arrayToList(Object data[]) array To List List newdata = new ArrayList(); Object aobj[]; int j = (aobj = data).length; for (int i = 0; i < j; i++) { Object curbyte = aobj[i]; newdata.add(curbyte); return newdata; ... |
List> | arrayToList(Object[] arr) array To List List<?> list = new ArrayList<>(); if (arr == null) { return list; list = Arrays.asList(arr); return list; |
List | arrayToList(Object[] hyCycles) array To List List list = new ArrayList(); Collections.addAll(list, hyCycles); return list; |
List | arrayToList(String[] array, String... defaults) array To List List<String> ret; if (array == null || array.length == 0) { ret = Arrays.asList(defaults); } else { ret = new ArrayList<>(array.length); for (String entry : array) { String[] parts = entry.split(",\\s*"); ret.addAll(Arrays.asList(parts)); ... |
List | arrayToList(String[] arrValues) Convenience method to return a String array as a CSV String. List values = null; if (arrValues != null) { values = new ArrayList(); int size = arrValues.length; for (int i = 0; i < size; i++) { values.add(arrValues[i]); return values; |