Returns an array containing each value of collection, converted to a long value in the manner of Number#longValue. Elements are copied from the argument collection as if by collection.toArray(). Calling this method is as thread-safe as calling that method. @param
(Collection<? extends Number> collection)
| 574 | |
| 575 | |
| 576 | public static long[] toArray(Collection<? extends Number> collection) { |
| 577 | if (collection instanceof LongArrayAsList) { |
| 578 | return ((LongArrayAsList) collection).toLongArray(); |
| 579 | } |
| 580 | Object[] boxedArray = collection.toArray(); |
| 581 | int len = boxedArray.length; |
| 582 | long[] array = new long[len]; |
| 583 | for (int i = 0; i < len; i++) { |
| 584 | // checkNotNull for GWT (do not optimize) |
| 585 | array[i] = ((Number) checkNotNull(boxedArray[i])).longValue(); |
| 586 | } |
| 587 | return array; |
| 588 | } |
| 589 | |
| 590 | /** |
| 591 | * Returns a fixed-size list backed by the specified array, similar to |
nothing calls this directly
no test coverage detected