From bdcb90c3d4e0df33b095a5deaaf7daf1b81862ca Mon Sep 17 00:00:00 2001 From: Ilya Gorbunov Date: Wed, 16 Jan 2019 06:28:05 +0300 Subject: [PATCH] Move Array.sortWith to generated code --- runtime/src/main/kotlin/generated/_ArraysNative.kt | 9 +++++++++ runtime/src/main/kotlin/kotlin/collections/Arrays.kt | 10 ---------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/runtime/src/main/kotlin/generated/_ArraysNative.kt b/runtime/src/main/kotlin/generated/_ArraysNative.kt index b1665b398be..c1be4dee4ef 100644 --- a/runtime/src/main/kotlin/generated/_ArraysNative.kt +++ b/runtime/src/main/kotlin/generated/_ArraysNative.kt @@ -1404,6 +1404,15 @@ public actual fun Array.sortWith(comparator: Comparator): Unit if (size > 1) sortArrayWith(this, 0, size, comparator) } +/** + * Sorts a range in the array in-place with the given [comparator]. + * + * The sort is _stable_. It means that equal elements preserve their order relative to each other after sorting. + */ +public fun Array.sortWith(comparator: Comparator, fromIndex: Int = 0, toIndex: Int = size): Unit { + sortArrayWith(this, fromIndex, toIndex, comparator) +} + /** * Returns a *typed* object array containing all of the elements of this primitive array. */ diff --git a/runtime/src/main/kotlin/kotlin/collections/Arrays.kt b/runtime/src/main/kotlin/kotlin/collections/Arrays.kt index 25871476ff6..500d0369264 100644 --- a/runtime/src/main/kotlin/kotlin/collections/Arrays.kt +++ b/runtime/src/main/kotlin/kotlin/collections/Arrays.kt @@ -19,16 +19,6 @@ public actual inline fun Array?.orEmpty(): Array = thi throw IllegalArgumentException("fromIndex ($fromIndex) is greater than toIndex ($toIndex).") } -// TODO: Move to generated code -/** - * Sorts a range in the array in-place with the given [comparator]. - * - * The sort is _stable_. It means that equal elements preserve their order relative to each other after sorting. - */ -public fun Array.sortWith(comparator: Comparator, fromIndex: Int = 0, toIndex: Int = size): Unit { - sortArrayWith(this, fromIndex, toIndex, comparator) -} - // TODO: internal /**