List of utility methods to do Collection to Array
Class>[] | toClassArray(Collection to Class Array return collection == null ? null : collection.toArray(new Class[collection.size()]); |
Class[] | toClassArray(final Collection collection) Convert the collection of class types to an array of class types. return (Class[]) collection.toArray(new Class[collection.size()]); |
Double[] | toDouble(final Collection extends Number> numbers) to Double return toDouble(numbers.toArray(new Number[numbers.size()])); |
double[] | toDoubleArray(Collection extends Number> items) Convert a Collection of Numbers to an array of primitive doubles Null values will be skipped in the array double ret[] = new double[items.size()]; int idx = 0; for (Number n : items) { if (n != null) ret[idx] = n.doubleValue(); idx += 1; return (ret); ... |
double[] | toDoubleArray(Collection to Double Array double[] out = new double[ds.size()]; int index = 0; for (Double d : ds) out[index++] = d; return out; |
Double[] | toDoubleArray(final Collection Converts the given collection of Doubles to an array of Doubles. if (doubleColl == null) { return new Double[0]; return doubleColl.toArray(new Double[doubleColl.size()]); |
Object | toFloatArray(Collection collection) to Float Array return toFloatArray(new float[collection.size()], collection); |
float[] | toFloatArray(Collection extends Number> c) to Float Array float arr[] = new float[c.size()]; int i = 0; for (Number item : c) { arr[i++] = item.floatValue(); return arr; |
float[] | toFloatArray(Collection to Float Array float[] resultArray = new float[array.size()]; int i = 0; for (float s : array) { resultArray[i++] = s; return resultArray; |
float[] | toFloatArray(final Collection to Float Array if (null == c || c.isEmpty()) { return new float[0]; final float[] list = new float[c.size()]; int i = 0; for (final Number item : c) { list[i] = item.floatValue(); i++; ... |