From 672a40c7cb43dc45c9fb3a1a5425d85a8ae57963 Mon Sep 17 00:00:00 2001 From: Abduqodiri Qurbonzoda Date: Thu, 1 Jun 2023 00:37:00 +0300 Subject: [PATCH] [K/N] Remove redundant collectionToArray functions --- .../kotlin/kotlin/collections/ArrayUtil.kt | 27 ------------------- 1 file changed, 27 deletions(-) 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.