Null-terminate Collection.toArray destination only in JVM
In other platforms the elements following the collection elements should not be changed. As a part of efforts to stabilize Native stdlib.
This commit is contained in:
committed by
Space Team
parent
60455daa9d
commit
6fdfd4e8dd
@@ -34,8 +34,5 @@ internal actual fun <T> copyToArrayImpl(collection: Collection<*>, array: Array<
|
||||
while (iterator.hasNext()) {
|
||||
array[index++] = iterator.next() as T
|
||||
}
|
||||
if (index < array.size) {
|
||||
(array as Array<T?>).fill(null, index)
|
||||
}
|
||||
return array
|
||||
return terminateCollectionToArray(collection.size, array)
|
||||
}
|
||||
Reference in New Issue
Block a user