Returns an array containing each value of collection, converted to a float value in the manner of Number#floatValue. Elements are copied from the argument collection as if by collection.toArray(). Calling this method is as thread-safe as calling that method. @par
(Collection<? extends Number> collection)
| 417 | |
| 418 | |
| 419 | public static float[] toArray(Collection<? extends Number> collection) { |
| 420 | if (collection instanceof FloatArrayAsList) { |
| 421 | return ((FloatArrayAsList) collection).toFloatArray(); |
| 422 | } |
| 423 | Object[] boxedArray = collection.toArray(); |
| 424 | int len = boxedArray.length; |
| 425 | float[] array = new float[len]; |
| 426 | for (int i = 0; i < len; i++) { |
| 427 | // checkNotNull for GWT (do not optimize) |
| 428 | array[i] = ((Number) checkNotNull(boxedArray[i])).floatValue(); |
| 429 | } |
| 430 | return array; |
| 431 | } |
| 432 | |
| 433 | /** |
| 434 | * Returns a fixed-size list backed by the specified array, similar to |
nothing calls this directly
no test coverage detected