Move Array.sortWith to generated code

This commit is contained in:
Ilya Gorbunov
2019-01-16 06:28:05 +03:00
committed by Vasily Levchenko
parent 38ca63418d
commit bdcb90c3d4
2 changed files with 9 additions and 10 deletions
@@ -1404,6 +1404,15 @@ public actual fun <T> Array<out T>.sortWith(comparator: Comparator<in T>): 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 <T> Array<out T>.sortWith(comparator: Comparator<in T>, 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.
*/
@@ -19,16 +19,6 @@ public actual inline fun <reified T> Array<out T>?.orEmpty(): Array<out T> = 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 <T> Array<out T>.sortWith(comparator: Comparator<in T>, fromIndex: Int = 0, toIndex: Int = size): Unit {
sortArrayWith(this, fromIndex, toIndex, comparator)
}
// TODO: internal
/**