Returns an array containing each value of collection, converted to a int value in the manner of Number#intValue. Elements are copied from the argument collection as if by collection.toArray(). Calling this method is as thread-safe as calling that method. @param c
(Collection<? extends Number> collection)
| 490 | |
| 491 | |
| 492 | public static int[] toArray(Collection<? extends Number> collection) { |
| 493 | if (collection instanceof IntArrayAsList) { |
| 494 | return ((IntArrayAsList) collection).toIntArray(); |
| 495 | } |
| 496 | Object[] boxedArray = collection.toArray(); |
| 497 | int len = boxedArray.length; |
| 498 | int[] array = new int[len]; |
| 499 | for (int i = 0; i < len; i++) { |
| 500 | // checkNotNull for GWT (do not optimize) |
| 501 | array[i] = ((Number) checkNotNull(boxedArray[i])).intValue(); |
| 502 | } |
| 503 | return array; |
| 504 | } |
| 505 | |
| 506 | /** |
| 507 | * Returns a fixed-size list backed by the specified array, similar to |
no test coverage detected