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)
| 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 |
no test coverage detected