List of utility methods to do Collection to Array
double[] | toArray(Collection Returns an array representation double[] result = new double[values.size()]; int i = 0; for (Double value : values) { result[i] = value; i++; return result; |
double[] | toArray(Collection to Array if (values == null) { throw new IllegalArgumentException("No null value allowed!"); double[] result = new double[values.size()]; int cnt = 0; for (Double value : values) { result[cnt++] = value; return result; |
int[] | toArray(Collection Transforms a Collection of Integer instances to a simple int array.
if (collection.isEmpty()) return EMPTY_ARRAY; int[] array = new int[collection.size()]; Iterator<Integer> iterator = collection.iterator(); for (int n = 0; iterator.hasNext(); ++n) array[n] = iterator.next().intValue(); return array; |
int[] | toArray(Collection Method toArray. int[] ar = new int[collection.size()]; int i = 0; for (Integer t : collection) { ar[i++] = t; return ar; |
long[] | toArray(Collection to Array if (collection == null) return new long[0]; long[] ret = new long[collection.size()]; int count = 0; for (Long element : collection) { if (element == null) { if (defaultValue == null) continue; ... |
String[] | toArray(Collection to Array String[] array = new String[col.size()]; col.toArray(array); return array; |
String | toArray(Collection Converts a collection of Strings into a Javascript array. StringBuilder sb = new StringBuilder("["); Iterator<String> it = collection.iterator(); while (it.hasNext()) { sb.append("'"); sb.append(it.next()); sb.append("'"); if (it.hasNext()) { sb.append(","); ... |
String[] | toArray(Collection to Array if (collection == null) { throw new IllegalArgumentException("argument must not be null."); return collection.toArray(new String[collection.size()]); |
String[] | toArray(Collection Shortcut to create a string array from a collection of strings return list.toArray(new String[list.size()]); |
String[] | toArray(Collection produces a String[] out of a String Collection. String[] sArray = new String[stringCollection.size()]; int i = 0; for (Iterator<String> iterator = stringCollection.iterator(); iterator.hasNext();) { sArray[i] = (String) iterator.next(); i++; return sArray; |