List of utility methods to do Array to ArrayList
ArrayList | arrayToArrayList(Object aobj[]) array To Array List ArrayList<Object> arraylist = new ArrayList<Object>(); if (aobj != null && aobj.length > 0) { for (int i = 0; i < aobj.length; i++) arraylist.add(aobj[i]); return arraylist; |
ArrayList | arrayToArrayList(Object[] array) Convert array into list ArrayList list = new ArrayList(); if (array != null) for (int i = 0; i < array.length; i++) list.add(array[i]); return list; |
ArrayList | arrayToArrayList(Object[] myArray) This method converts an array into an ArrayList. int i = 0; ArrayList out = new ArrayList(); for (i = 0; i < myArray.length; i++) { Object extract = myArray[i]; out.add(extract); return (out); |
ArrayList | arrayToArraylist(String[] array) array To Arraylist return new ArrayList<String>(Arrays.asList(array)); |
ArrayList | arrayToArrayList(T[] array) Converts a Java array to an ArrayList . if (array == null) throw new IllegalArgumentException("Parameter 'array' cannot be null!"); ArrayList<T> arrayList = new ArrayList<T>(); for (T element : array) arrayList.add(element); return arrayList; |
ArrayList | arrayToArraylist(T[] array) array To Arraylist ArrayList<T> ret = new ArrayList<T>(); for (T e : array) { ret.add(e); return ret; |
ArrayList | asArrayList(Collection c) as Array List return (ArrayList) asTargetTypeCollection(c, ArrayList.class); |
ArrayList | asArrayList(T... elements) as Array List ArrayList<T> result = new ArrayList<T>(); for (T elem : elements) { result.add(elem); return result; |
ArrayList | asArrayList(T[] tArray) Converts the typed Array into a typed ArrayList ArrayList<T> tList = new ArrayList<T>(); for (T t : tArray) { tList.add(t); return tList; |
List | asArrayList(T[] values) Arrays.asList cannot be reliably used for SQL parameters on MyBatis < 3.3.0 ArrayList<T> result = new ArrayList<T>(); Collections.addAll(result, values); return result; |