diff --git a/kotlin-native/runtime/src/main/kotlin/kotlin/collections/ArrayUtil.kt b/kotlin-native/runtime/src/main/kotlin/kotlin/collections/ArrayUtil.kt index 169bd2ed0b9..9548bd6a5a6 100644 --- a/kotlin-native/runtime/src/main/kotlin/kotlin/collections/ArrayUtil.kt +++ b/kotlin-native/runtime/src/main/kotlin/kotlin/collections/ArrayUtil.kt @@ -22,33 +22,6 @@ internal inline fun arrayOfUninitializedElements(size: Int): Array { return Array(size) } -/** - * Copies elements of the [collection] into the given [array]. - * If the array is too small, allocates a new one of collection.size size. - * @return [array] with the elements copied from the collection. - */ -internal fun collectionToArray(collection: Collection, array: Array): Array { - val toArray = if (collection.size > array.size) { - arrayOfUninitializedElements(collection.size) - } else { - array - } - var i = 0 - for (v in collection) { - @Suppress("UNCHECKED_CAST") - toArray[i] = v as T - i++ - } - return toArray -} - -/** - * Creates an array of collection.size size and copies elements of the [collection] into it. - * @return [array] with the elements copied from the collection. - */ -internal fun collectionToArray(collection: Collection): Array - = collectionToArray(collection, arrayOfUninitializedElements(collection.size)) - /** * Resets an array element at a specified index to some implementation-specific _uninitialized_ value.