List of utility methods to do Collection to Array
int[] | toIntArray(final Collection extends Number> c) to Int Array if (c == null) { return null; final int[] r = new int[c.size()]; int i = 0; for (final Number n : c) { r[i++] = n.intValue(); return r; |
int[] | toIntArray(final Collection Convert a collection of int to an array of ints. if (col == null) return null; final int[] result = new int[col.size()]; int i = 0; for (Integer val : col) result[i++] = val; return result; |
int[] | toIntArray(final Collection to Int Array final int[] array = new int[collection.size()]; int i = 0; for (Integer integer : collection) array[i++] = integer; return array; |
int[] | toIntArray(final Collection Converts a list of Integer objects into an array of primitive int s.
final int[] items = new int[values.size()]; final Iterator<Integer> iterator = values.iterator(); for (int i = 0; i < items.length; i++) { items[i] = iterator.next(); return items; |
Long[] | toLongArray(Collection This method converts collection to Long Array. Long[] obj = new Long[collection.size()]; int index = 0; Iterator<Long> iterator = collection.iterator(); while (iterator.hasNext()) { obj[index] = (Long) iterator.next(); index++; return obj; ... |
long[] | toLongArray(Collection Converts a Collection long[] collectionArray = new long[collection.size()]; int index = 0; for (Long item : collection) { collectionArray[index++] = item; return collectionArray; |
String[] | toStringArray(Collection collection) Copy the given Collection into a String array. if (collection == null) { return null; return (String[]) collection.toArray(new String[collection.size()]); |
String[] | toStringArray(Collection collection) to String Array String[] result = new String[collection.size()]; int i = 0; for (Object obj : collection) { result[i++] = obj.toString(); return result; |
String[] | toStringArray(Collection collection) Copy the given Collection into a String array. if (collection == null) { return null; return (String[]) collection.toArray(new String[collection.size()]); |
String[] | toStringArray(Collection> collection) to String Array if (collection == null) { return null; if (collection.isEmpty()) { return EMPTY_STRING_ARRAY; List<String> list = new ArrayList<>(collection.size()); for (Object o : collection) { ... |