MCPcopy Create free account
hub / github.com/antlr/codebuff / toArray

Method toArray

output/java_guava/1.4.17/Doubles.java:424–436  ·  view source on GitHub ↗

Returns an array containing each value of collection, converted to a double value in the manner of Number#doubleValue. Elements are copied from the argument collection as if by collection.toArray(). Calling this method is as thread-safe as calling that method. @p

(Collection<? extends Number> collection)

Source from the content-addressed store, hash-verified

422
423
424 public static double[] toArray(Collection<? extends Number> collection) {
425 if (collection instanceof DoubleArrayAsList) {
426 return ((DoubleArrayAsList) collection).toDoubleArray();
427 }
428 Object[] boxedArray = collection.toArray();
429 int len = boxedArray.length;
430 double[] array = new double[len];
431 for (int i = 0; i < len; i++) {
432 // checkNotNull for GWT (do not optimize)
433 array[i] = ((Number) checkNotNull(boxedArray[i])).doubleValue();
434 }
435 return array;
436 }
437
438 /**
439 * Returns a fixed-size list backed by the specified array, similar to

Callers 2

computeMethod · 0.95
computeMethod · 0.95

Calls 3

toDoubleArrayMethod · 0.45
doubleValueMethod · 0.45
checkNotNullMethod · 0.45

Tested by

no test coverage detected