Returns an array containing all of the elements in the specified collection; the runtime type of the returned array is that of the specified array. If the collection fits in the specified array, it is returned therein. Otherwise, a new array is allocated with the runtime type of the specified array
(Collection<?> c, T[] array)
| 150 | |
| 151 | |
| 152 | static <T> T[] toArrayImpl(Collection<?> c, T[] array) { |
| 153 | int size = c.size(); |
| 154 | if (array.length < size) { |
| 155 | array = newArray(array, size); |
| 156 | } |
| 157 | fillArray(c, array); |
| 158 | if (array.length > size) { |
| 159 | array[size] = null; |
| 160 | } |
| 161 | return array; |
| 162 | } |
| 163 | |
| 164 | /** |
| 165 | * Implementation of {@link Collection#toArray(Object[])} for collections backed by an object |
no test coverage detected