Document fromIndex and toIndex parameters #KT-38388

This commit is contained in:
Abduqodiri Qurbonzoda
2020-04-21 05:59:10 +03:00
parent 3c1b41c020
commit 0c7b04a495
9 changed files with 893 additions and 209 deletions
+219 -36
View File
@@ -5251,6 +5251,12 @@ public fun CharArray.reverse(): Unit {
/**
* Reverses elements of the array in the specified range in-place.
*
* @param fromIndex the start of the range (inclusive) to reverse.
* @param toIndex the end of the range (exclusive) to reverse.
*
* @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.
* @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].
*/
@SinceKotlin("1.4")
public fun <T> Array<T>.reverse(fromIndex: Int, toIndex: Int): Unit {
@@ -5268,6 +5274,12 @@ public fun <T> Array<T>.reverse(fromIndex: Int, toIndex: Int): Unit {
/**
* Reverses elements of the array in the specified range in-place.
*
* @param fromIndex the start of the range (inclusive) to reverse.
* @param toIndex the end of the range (exclusive) to reverse.
*
* @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.
* @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].
*/
@SinceKotlin("1.4")
public fun ByteArray.reverse(fromIndex: Int, toIndex: Int): Unit {
@@ -5285,6 +5297,12 @@ public fun ByteArray.reverse(fromIndex: Int, toIndex: Int): Unit {
/**
* Reverses elements of the array in the specified range in-place.
*
* @param fromIndex the start of the range (inclusive) to reverse.
* @param toIndex the end of the range (exclusive) to reverse.
*
* @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.
* @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].
*/
@SinceKotlin("1.4")
public fun ShortArray.reverse(fromIndex: Int, toIndex: Int): Unit {
@@ -5302,6 +5320,12 @@ public fun ShortArray.reverse(fromIndex: Int, toIndex: Int): Unit {
/**
* Reverses elements of the array in the specified range in-place.
*
* @param fromIndex the start of the range (inclusive) to reverse.
* @param toIndex the end of the range (exclusive) to reverse.
*
* @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.
* @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].
*/
@SinceKotlin("1.4")
public fun IntArray.reverse(fromIndex: Int, toIndex: Int): Unit {
@@ -5319,6 +5343,12 @@ public fun IntArray.reverse(fromIndex: Int, toIndex: Int): Unit {
/**
* Reverses elements of the array in the specified range in-place.
*
* @param fromIndex the start of the range (inclusive) to reverse.
* @param toIndex the end of the range (exclusive) to reverse.
*
* @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.
* @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].
*/
@SinceKotlin("1.4")
public fun LongArray.reverse(fromIndex: Int, toIndex: Int): Unit {
@@ -5336,6 +5366,12 @@ public fun LongArray.reverse(fromIndex: Int, toIndex: Int): Unit {
/**
* Reverses elements of the array in the specified range in-place.
*
* @param fromIndex the start of the range (inclusive) to reverse.
* @param toIndex the end of the range (exclusive) to reverse.
*
* @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.
* @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].
*/
@SinceKotlin("1.4")
public fun FloatArray.reverse(fromIndex: Int, toIndex: Int): Unit {
@@ -5353,6 +5389,12 @@ public fun FloatArray.reverse(fromIndex: Int, toIndex: Int): Unit {
/**
* Reverses elements of the array in the specified range in-place.
*
* @param fromIndex the start of the range (inclusive) to reverse.
* @param toIndex the end of the range (exclusive) to reverse.
*
* @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.
* @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].
*/
@SinceKotlin("1.4")
public fun DoubleArray.reverse(fromIndex: Int, toIndex: Int): Unit {
@@ -5370,6 +5412,12 @@ public fun DoubleArray.reverse(fromIndex: Int, toIndex: Int): Unit {
/**
* Reverses elements of the array in the specified range in-place.
*
* @param fromIndex the start of the range (inclusive) to reverse.
* @param toIndex the end of the range (exclusive) to reverse.
*
* @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.
* @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].
*/
@SinceKotlin("1.4")
public fun BooleanArray.reverse(fromIndex: Int, toIndex: Int): Unit {
@@ -5387,6 +5435,12 @@ public fun BooleanArray.reverse(fromIndex: Int, toIndex: Int): Unit {
/**
* Reverses elements of the array in the specified range in-place.
*
* @param fromIndex the start of the range (inclusive) to reverse.
* @param toIndex the end of the range (exclusive) to reverse.
*
* @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.
* @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].
*/
@SinceKotlin("1.4")
public fun CharArray.reverse(fromIndex: Int, toIndex: Int): Unit {
@@ -7272,8 +7326,11 @@ public expect fun <T> Array<T>.copyOf(newSize: Int): Array<T?>
/**
* Returns a new array which is a copy of the specified range of the original array.
*
* @param fromIndex the start of the range (inclusive), must be in `0..array.size`
* @param toIndex the end of the range (exclusive), must be in `fromIndex..array.size`
* @param fromIndex the start of the range (inclusive) to copy.
* @param toIndex the end of the range (exclusive) to copy.
*
* @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.
* @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].
*/
@Suppress("NO_ACTUAL_FOR_EXPECT")
public expect fun <T> Array<T>.copyOfRange(fromIndex: Int, toIndex: Int): Array<T>
@@ -7281,72 +7338,96 @@ public expect fun <T> Array<T>.copyOfRange(fromIndex: Int, toIndex: Int): Array<
/**
* Returns a new array which is a copy of the specified range of the original array.
*
* @param fromIndex the start of the range (inclusive), must be in `0..array.size`
* @param toIndex the end of the range (exclusive), must be in `fromIndex..array.size`
* @param fromIndex the start of the range (inclusive) to copy.
* @param toIndex the end of the range (exclusive) to copy.
*
* @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.
* @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].
*/
public expect fun ByteArray.copyOfRange(fromIndex: Int, toIndex: Int): ByteArray
/**
* Returns a new array which is a copy of the specified range of the original array.
*
* @param fromIndex the start of the range (inclusive), must be in `0..array.size`
* @param toIndex the end of the range (exclusive), must be in `fromIndex..array.size`
* @param fromIndex the start of the range (inclusive) to copy.
* @param toIndex the end of the range (exclusive) to copy.
*
* @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.
* @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].
*/
public expect fun ShortArray.copyOfRange(fromIndex: Int, toIndex: Int): ShortArray
/**
* Returns a new array which is a copy of the specified range of the original array.
*
* @param fromIndex the start of the range (inclusive), must be in `0..array.size`
* @param toIndex the end of the range (exclusive), must be in `fromIndex..array.size`
* @param fromIndex the start of the range (inclusive) to copy.
* @param toIndex the end of the range (exclusive) to copy.
*
* @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.
* @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].
*/
public expect fun IntArray.copyOfRange(fromIndex: Int, toIndex: Int): IntArray
/**
* Returns a new array which is a copy of the specified range of the original array.
*
* @param fromIndex the start of the range (inclusive), must be in `0..array.size`
* @param toIndex the end of the range (exclusive), must be in `fromIndex..array.size`
* @param fromIndex the start of the range (inclusive) to copy.
* @param toIndex the end of the range (exclusive) to copy.
*
* @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.
* @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].
*/
public expect fun LongArray.copyOfRange(fromIndex: Int, toIndex: Int): LongArray
/**
* Returns a new array which is a copy of the specified range of the original array.
*
* @param fromIndex the start of the range (inclusive), must be in `0..array.size`
* @param toIndex the end of the range (exclusive), must be in `fromIndex..array.size`
* @param fromIndex the start of the range (inclusive) to copy.
* @param toIndex the end of the range (exclusive) to copy.
*
* @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.
* @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].
*/
public expect fun FloatArray.copyOfRange(fromIndex: Int, toIndex: Int): FloatArray
/**
* Returns a new array which is a copy of the specified range of the original array.
*
* @param fromIndex the start of the range (inclusive), must be in `0..array.size`
* @param toIndex the end of the range (exclusive), must be in `fromIndex..array.size`
* @param fromIndex the start of the range (inclusive) to copy.
* @param toIndex the end of the range (exclusive) to copy.
*
* @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.
* @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].
*/
public expect fun DoubleArray.copyOfRange(fromIndex: Int, toIndex: Int): DoubleArray
/**
* Returns a new array which is a copy of the specified range of the original array.
*
* @param fromIndex the start of the range (inclusive), must be in `0..array.size`
* @param toIndex the end of the range (exclusive), must be in `fromIndex..array.size`
* @param fromIndex the start of the range (inclusive) to copy.
* @param toIndex the end of the range (exclusive) to copy.
*
* @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.
* @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].
*/
public expect fun BooleanArray.copyOfRange(fromIndex: Int, toIndex: Int): BooleanArray
/**
* Returns a new array which is a copy of the specified range of the original array.
*
* @param fromIndex the start of the range (inclusive), must be in `0..array.size`
* @param toIndex the end of the range (exclusive), must be in `fromIndex..array.size`
* @param fromIndex the start of the range (inclusive) to copy.
* @param toIndex the end of the range (exclusive) to copy.
*
* @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.
* @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].
*/
public expect fun CharArray.copyOfRange(fromIndex: Int, toIndex: Int): CharArray
/**
* Fills this array or its subrange with the specified [element] value.
*
* @param fromIndex the start of the range (inclusive), 0 by default.
* @param toIndex the end of the range (exclusive), size of this array by default.
* @param fromIndex the start of the range (inclusive) to fill, 0 by default.
* @param toIndex the end of the range (exclusive) to fill, size of this array by default.
*
* @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.
* @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].
@@ -7357,8 +7438,8 @@ public expect fun <T> Array<T>.fill(element: T, fromIndex: Int = 0, toIndex: Int
/**
* Fills this array or its subrange with the specified [element] value.
*
* @param fromIndex the start of the range (inclusive), 0 by default.
* @param toIndex the end of the range (exclusive), size of this array by default.
* @param fromIndex the start of the range (inclusive) to fill, 0 by default.
* @param toIndex the end of the range (exclusive) to fill, size of this array by default.
*
* @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.
* @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].
@@ -7369,8 +7450,8 @@ public expect fun ByteArray.fill(element: Byte, fromIndex: Int = 0, toIndex: Int
/**
* Fills this array or its subrange with the specified [element] value.
*
* @param fromIndex the start of the range (inclusive), 0 by default.
* @param toIndex the end of the range (exclusive), size of this array by default.
* @param fromIndex the start of the range (inclusive) to fill, 0 by default.
* @param toIndex the end of the range (exclusive) to fill, size of this array by default.
*
* @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.
* @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].
@@ -7381,8 +7462,8 @@ public expect fun ShortArray.fill(element: Short, fromIndex: Int = 0, toIndex: I
/**
* Fills this array or its subrange with the specified [element] value.
*
* @param fromIndex the start of the range (inclusive), 0 by default.
* @param toIndex the end of the range (exclusive), size of this array by default.
* @param fromIndex the start of the range (inclusive) to fill, 0 by default.
* @param toIndex the end of the range (exclusive) to fill, size of this array by default.
*
* @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.
* @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].
@@ -7393,8 +7474,8 @@ public expect fun IntArray.fill(element: Int, fromIndex: Int = 0, toIndex: Int =
/**
* Fills this array or its subrange with the specified [element] value.
*
* @param fromIndex the start of the range (inclusive), 0 by default.
* @param toIndex the end of the range (exclusive), size of this array by default.
* @param fromIndex the start of the range (inclusive) to fill, 0 by default.
* @param toIndex the end of the range (exclusive) to fill, size of this array by default.
*
* @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.
* @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].
@@ -7405,8 +7486,8 @@ public expect fun LongArray.fill(element: Long, fromIndex: Int = 0, toIndex: Int
/**
* Fills this array or its subrange with the specified [element] value.
*
* @param fromIndex the start of the range (inclusive), 0 by default.
* @param toIndex the end of the range (exclusive), size of this array by default.
* @param fromIndex the start of the range (inclusive) to fill, 0 by default.
* @param toIndex the end of the range (exclusive) to fill, size of this array by default.
*
* @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.
* @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].
@@ -7417,8 +7498,8 @@ public expect fun FloatArray.fill(element: Float, fromIndex: Int = 0, toIndex: I
/**
* Fills this array or its subrange with the specified [element] value.
*
* @param fromIndex the start of the range (inclusive), 0 by default.
* @param toIndex the end of the range (exclusive), size of this array by default.
* @param fromIndex the start of the range (inclusive) to fill, 0 by default.
* @param toIndex the end of the range (exclusive) to fill, size of this array by default.
*
* @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.
* @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].
@@ -7429,8 +7510,8 @@ public expect fun DoubleArray.fill(element: Double, fromIndex: Int = 0, toIndex:
/**
* Fills this array or its subrange with the specified [element] value.
*
* @param fromIndex the start of the range (inclusive), 0 by default.
* @param toIndex the end of the range (exclusive), size of this array by default.
* @param fromIndex the start of the range (inclusive) to fill, 0 by default.
* @param toIndex the end of the range (exclusive) to fill, size of this array by default.
*
* @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.
* @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].
@@ -7441,8 +7522,8 @@ public expect fun BooleanArray.fill(element: Boolean, fromIndex: Int = 0, toInde
/**
* Fills this array or its subrange with the specified [element] value.
*
* @param fromIndex the start of the range (inclusive), 0 by default.
* @param toIndex the end of the range (exclusive), size of this array by default.
* @param fromIndex the start of the range (inclusive) to fill, 0 by default.
* @param toIndex the end of the range (exclusive) to fill, size of this array by default.
*
* @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.
* @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].
@@ -7909,6 +7990,12 @@ public expect fun <T : Comparable<T>> Array<out T>.sort(): Unit
*
* The sort is _stable_. It means that equal elements preserve their order relative to each other after sorting.
*
* @param fromIndex the start of the range (inclusive) to sort, 0 by default.
* @param toIndex the end of the range (exclusive) to sort, size of this array by default.
*
* @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.
* @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].
*
* @sample samples.collections.Arrays.Sorting.sortRangeOfArrayOfComparable
*/
@SinceKotlin("1.4")
@@ -7917,6 +8004,12 @@ public expect fun <T : Comparable<T>> Array<out T>.sort(fromIndex: Int = 0, toIn
/**
* Sorts a range in the array in-place.
*
* @param fromIndex the start of the range (inclusive) to sort, 0 by default.
* @param toIndex the end of the range (exclusive) to sort, size of this array by default.
*
* @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.
* @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].
*
* @sample samples.collections.Arrays.Sorting.sortRangeOfArray
*/
@SinceKotlin("1.4")
@@ -7925,6 +8018,12 @@ public expect fun ByteArray.sort(fromIndex: Int = 0, toIndex: Int = size): Unit
/**
* Sorts a range in the array in-place.
*
* @param fromIndex the start of the range (inclusive) to sort, 0 by default.
* @param toIndex the end of the range (exclusive) to sort, size of this array by default.
*
* @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.
* @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].
*
* @sample samples.collections.Arrays.Sorting.sortRangeOfArray
*/
@SinceKotlin("1.4")
@@ -7933,6 +8032,12 @@ public expect fun ShortArray.sort(fromIndex: Int = 0, toIndex: Int = size): Unit
/**
* Sorts a range in the array in-place.
*
* @param fromIndex the start of the range (inclusive) to sort, 0 by default.
* @param toIndex the end of the range (exclusive) to sort, size of this array by default.
*
* @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.
* @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].
*
* @sample samples.collections.Arrays.Sorting.sortRangeOfArray
*/
@SinceKotlin("1.4")
@@ -7941,6 +8046,12 @@ public expect fun IntArray.sort(fromIndex: Int = 0, toIndex: Int = size): Unit
/**
* Sorts a range in the array in-place.
*
* @param fromIndex the start of the range (inclusive) to sort, 0 by default.
* @param toIndex the end of the range (exclusive) to sort, size of this array by default.
*
* @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.
* @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].
*
* @sample samples.collections.Arrays.Sorting.sortRangeOfArray
*/
@SinceKotlin("1.4")
@@ -7949,6 +8060,12 @@ public expect fun LongArray.sort(fromIndex: Int = 0, toIndex: Int = size): Unit
/**
* Sorts a range in the array in-place.
*
* @param fromIndex the start of the range (inclusive) to sort, 0 by default.
* @param toIndex the end of the range (exclusive) to sort, size of this array by default.
*
* @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.
* @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].
*
* @sample samples.collections.Arrays.Sorting.sortRangeOfArray
*/
@SinceKotlin("1.4")
@@ -7957,6 +8074,12 @@ public expect fun FloatArray.sort(fromIndex: Int = 0, toIndex: Int = size): Unit
/**
* Sorts a range in the array in-place.
*
* @param fromIndex the start of the range (inclusive) to sort, 0 by default.
* @param toIndex the end of the range (exclusive) to sort, size of this array by default.
*
* @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.
* @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].
*
* @sample samples.collections.Arrays.Sorting.sortRangeOfArray
*/
@SinceKotlin("1.4")
@@ -7965,6 +8088,12 @@ public expect fun DoubleArray.sort(fromIndex: Int = 0, toIndex: Int = size): Uni
/**
* Sorts a range in the array in-place.
*
* @param fromIndex the start of the range (inclusive) to sort, 0 by default.
* @param toIndex the end of the range (exclusive) to sort, size of this array by default.
*
* @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.
* @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].
*
* @sample samples.collections.Arrays.Sorting.sortRangeOfArray
*/
@SinceKotlin("1.4")
@@ -7975,6 +8104,12 @@ public expect fun CharArray.sort(fromIndex: Int = 0, toIndex: Int = size): Unit
* The elements are sorted descending according to their natural sort order.
*
* The sort is _stable_. It means that equal elements preserve their order relative to each other after sorting.
*
* @param fromIndex the start of the range (inclusive) to sort.
* @param toIndex the end of the range (exclusive) to sort.
*
* @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.
* @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].
*/
@SinceKotlin("1.4")
public fun <T : Comparable<T>> Array<out T>.sortDescending(fromIndex: Int, toIndex: Int): Unit {
@@ -7984,6 +8119,12 @@ public fun <T : Comparable<T>> Array<out T>.sortDescending(fromIndex: Int, toInd
/**
* Sorts elements of the array in the specified range in-place.
* The elements are sorted descending according to their natural sort order.
*
* @param fromIndex the start of the range (inclusive) to sort.
* @param toIndex the end of the range (exclusive) to sort.
*
* @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.
* @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].
*/
@SinceKotlin("1.4")
public fun ByteArray.sortDescending(fromIndex: Int, toIndex: Int): Unit {
@@ -7994,6 +8135,12 @@ public fun ByteArray.sortDescending(fromIndex: Int, toIndex: Int): Unit {
/**
* Sorts elements of the array in the specified range in-place.
* The elements are sorted descending according to their natural sort order.
*
* @param fromIndex the start of the range (inclusive) to sort.
* @param toIndex the end of the range (exclusive) to sort.
*
* @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.
* @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].
*/
@SinceKotlin("1.4")
public fun ShortArray.sortDescending(fromIndex: Int, toIndex: Int): Unit {
@@ -8004,6 +8151,12 @@ public fun ShortArray.sortDescending(fromIndex: Int, toIndex: Int): Unit {
/**
* Sorts elements of the array in the specified range in-place.
* The elements are sorted descending according to their natural sort order.
*
* @param fromIndex the start of the range (inclusive) to sort.
* @param toIndex the end of the range (exclusive) to sort.
*
* @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.
* @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].
*/
@SinceKotlin("1.4")
public fun IntArray.sortDescending(fromIndex: Int, toIndex: Int): Unit {
@@ -8014,6 +8167,12 @@ public fun IntArray.sortDescending(fromIndex: Int, toIndex: Int): Unit {
/**
* Sorts elements of the array in the specified range in-place.
* The elements are sorted descending according to their natural sort order.
*
* @param fromIndex the start of the range (inclusive) to sort.
* @param toIndex the end of the range (exclusive) to sort.
*
* @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.
* @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].
*/
@SinceKotlin("1.4")
public fun LongArray.sortDescending(fromIndex: Int, toIndex: Int): Unit {
@@ -8024,6 +8183,12 @@ public fun LongArray.sortDescending(fromIndex: Int, toIndex: Int): Unit {
/**
* Sorts elements of the array in the specified range in-place.
* The elements are sorted descending according to their natural sort order.
*
* @param fromIndex the start of the range (inclusive) to sort.
* @param toIndex the end of the range (exclusive) to sort.
*
* @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.
* @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].
*/
@SinceKotlin("1.4")
public fun FloatArray.sortDescending(fromIndex: Int, toIndex: Int): Unit {
@@ -8034,6 +8199,12 @@ public fun FloatArray.sortDescending(fromIndex: Int, toIndex: Int): Unit {
/**
* Sorts elements of the array in the specified range in-place.
* The elements are sorted descending according to their natural sort order.
*
* @param fromIndex the start of the range (inclusive) to sort.
* @param toIndex the end of the range (exclusive) to sort.
*
* @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.
* @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].
*/
@SinceKotlin("1.4")
public fun DoubleArray.sortDescending(fromIndex: Int, toIndex: Int): Unit {
@@ -8044,6 +8215,12 @@ public fun DoubleArray.sortDescending(fromIndex: Int, toIndex: Int): Unit {
/**
* Sorts elements of the array in the specified range in-place.
* The elements are sorted descending according to their natural sort order.
*
* @param fromIndex the start of the range (inclusive) to sort.
* @param toIndex the end of the range (exclusive) to sort.
*
* @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.
* @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].
*/
@SinceKotlin("1.4")
public fun CharArray.sortDescending(fromIndex: Int, toIndex: Int): Unit {
@@ -8062,6 +8239,12 @@ public expect fun <T> Array<out T>.sortWith(comparator: Comparator<in T>): Unit
* 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.
*
* @param fromIndex the start of the range (inclusive) to sort, 0 by default.
* @param toIndex the end of the range (exclusive) to sort, size of this array by default.
*
* @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.
* @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].
*/
public expect fun <T> Array<out T>.sortWith(comparator: Comparator<in T>, fromIndex: Int = 0, toIndex: Int = size): Unit
+100 -16
View File
@@ -2616,6 +2616,12 @@ public inline fun UShortArray.reverse(): Unit {
/**
* Reverses elements of the array in the specified range in-place.
*
* @param fromIndex the start of the range (inclusive) to reverse.
* @param toIndex the end of the range (exclusive) to reverse.
*
* @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.
* @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].
*/
@SinceKotlin("1.4")
@ExperimentalUnsignedTypes
@@ -2626,6 +2632,12 @@ public inline fun UIntArray.reverse(fromIndex: Int, toIndex: Int): Unit {
/**
* Reverses elements of the array in the specified range in-place.
*
* @param fromIndex the start of the range (inclusive) to reverse.
* @param toIndex the end of the range (exclusive) to reverse.
*
* @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.
* @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].
*/
@SinceKotlin("1.4")
@ExperimentalUnsignedTypes
@@ -2636,6 +2648,12 @@ public inline fun ULongArray.reverse(fromIndex: Int, toIndex: Int): Unit {
/**
* Reverses elements of the array in the specified range in-place.
*
* @param fromIndex the start of the range (inclusive) to reverse.
* @param toIndex the end of the range (exclusive) to reverse.
*
* @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.
* @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].
*/
@SinceKotlin("1.4")
@ExperimentalUnsignedTypes
@@ -2646,6 +2664,12 @@ public inline fun UByteArray.reverse(fromIndex: Int, toIndex: Int): Unit {
/**
* Reverses elements of the array in the specified range in-place.
*
* @param fromIndex the start of the range (inclusive) to reverse.
* @param toIndex the end of the range (exclusive) to reverse.
*
* @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.
* @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].
*/
@SinceKotlin("1.4")
@ExperimentalUnsignedTypes
@@ -3621,8 +3645,11 @@ public inline fun UShortArray.copyOf(newSize: Int): UShortArray {
/**
* Returns a new array which is a copy of the specified range of the original array.
*
* @param fromIndex the start of the range (inclusive), must be in `0..array.size`
* @param toIndex the end of the range (exclusive), must be in `fromIndex..array.size`
* @param fromIndex the start of the range (inclusive) to copy.
* @param toIndex the end of the range (exclusive) to copy.
*
* @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.
* @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@@ -3634,8 +3661,11 @@ public inline fun UIntArray.copyOfRange(fromIndex: Int, toIndex: Int): UIntArray
/**
* Returns a new array which is a copy of the specified range of the original array.
*
* @param fromIndex the start of the range (inclusive), must be in `0..array.size`
* @param toIndex the end of the range (exclusive), must be in `fromIndex..array.size`
* @param fromIndex the start of the range (inclusive) to copy.
* @param toIndex the end of the range (exclusive) to copy.
*
* @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.
* @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@@ -3647,8 +3677,11 @@ public inline fun ULongArray.copyOfRange(fromIndex: Int, toIndex: Int): ULongArr
/**
* Returns a new array which is a copy of the specified range of the original array.
*
* @param fromIndex the start of the range (inclusive), must be in `0..array.size`
* @param toIndex the end of the range (exclusive), must be in `fromIndex..array.size`
* @param fromIndex the start of the range (inclusive) to copy.
* @param toIndex the end of the range (exclusive) to copy.
*
* @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.
* @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@@ -3660,8 +3693,11 @@ public inline fun UByteArray.copyOfRange(fromIndex: Int, toIndex: Int): UByteArr
/**
* Returns a new array which is a copy of the specified range of the original array.
*
* @param fromIndex the start of the range (inclusive), must be in `0..array.size`
* @param toIndex the end of the range (exclusive), must be in `fromIndex..array.size`
* @param fromIndex the start of the range (inclusive) to copy.
* @param toIndex the end of the range (exclusive) to copy.
*
* @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.
* @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@@ -3673,8 +3709,8 @@ public inline fun UShortArray.copyOfRange(fromIndex: Int, toIndex: Int): UShortA
/**
* Fills this array or its subrange with the specified [element] value.
*
* @param fromIndex the start of the range (inclusive), 0 by default.
* @param toIndex the end of the range (exclusive), size of this array by default.
* @param fromIndex the start of the range (inclusive) to fill, 0 by default.
* @param toIndex the end of the range (exclusive) to fill, size of this array by default.
*
* @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.
* @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].
@@ -3688,8 +3724,8 @@ public fun UIntArray.fill(element: UInt, fromIndex: Int = 0, toIndex: Int = size
/**
* Fills this array or its subrange with the specified [element] value.
*
* @param fromIndex the start of the range (inclusive), 0 by default.
* @param toIndex the end of the range (exclusive), size of this array by default.
* @param fromIndex the start of the range (inclusive) to fill, 0 by default.
* @param toIndex the end of the range (exclusive) to fill, size of this array by default.
*
* @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.
* @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].
@@ -3703,8 +3739,8 @@ public fun ULongArray.fill(element: ULong, fromIndex: Int = 0, toIndex: Int = si
/**
* Fills this array or its subrange with the specified [element] value.
*
* @param fromIndex the start of the range (inclusive), 0 by default.
* @param toIndex the end of the range (exclusive), size of this array by default.
* @param fromIndex the start of the range (inclusive) to fill, 0 by default.
* @param toIndex the end of the range (exclusive) to fill, size of this array by default.
*
* @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.
* @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].
@@ -3718,8 +3754,8 @@ public fun UByteArray.fill(element: UByte, fromIndex: Int = 0, toIndex: Int = si
/**
* Fills this array or its subrange with the specified [element] value.
*
* @param fromIndex the start of the range (inclusive), 0 by default.
* @param toIndex the end of the range (exclusive), size of this array by default.
* @param fromIndex the start of the range (inclusive) to fill, 0 by default.
* @param toIndex the end of the range (exclusive) to fill, size of this array by default.
*
* @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.
* @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].
@@ -3968,6 +4004,12 @@ public fun UShortArray.sort(): Unit {
/**
* Sorts a range in the array in-place.
*
* @param fromIndex the start of the range (inclusive) to sort, 0 by default.
* @param toIndex the end of the range (exclusive) to sort, size of this array by default.
*
* @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.
* @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].
*/
@SinceKotlin("1.4")
@ExperimentalUnsignedTypes
@@ -3978,6 +4020,12 @@ public fun UIntArray.sort(fromIndex: Int = 0, toIndex: Int = size): Unit {
/**
* Sorts a range in the array in-place.
*
* @param fromIndex the start of the range (inclusive) to sort, 0 by default.
* @param toIndex the end of the range (exclusive) to sort, size of this array by default.
*
* @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.
* @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].
*/
@SinceKotlin("1.4")
@ExperimentalUnsignedTypes
@@ -3988,6 +4036,12 @@ public fun ULongArray.sort(fromIndex: Int = 0, toIndex: Int = size): Unit {
/**
* Sorts a range in the array in-place.
*
* @param fromIndex the start of the range (inclusive) to sort, 0 by default.
* @param toIndex the end of the range (exclusive) to sort, size of this array by default.
*
* @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.
* @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].
*/
@SinceKotlin("1.4")
@ExperimentalUnsignedTypes
@@ -3998,6 +4052,12 @@ public fun UByteArray.sort(fromIndex: Int = 0, toIndex: Int = size): Unit {
/**
* Sorts a range in the array in-place.
*
* @param fromIndex the start of the range (inclusive) to sort, 0 by default.
* @param toIndex the end of the range (exclusive) to sort, size of this array by default.
*
* @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.
* @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].
*/
@SinceKotlin("1.4")
@ExperimentalUnsignedTypes
@@ -4009,6 +4069,12 @@ public fun UShortArray.sort(fromIndex: Int = 0, toIndex: Int = size): Unit {
/**
* Sorts elements of the array in the specified range in-place.
* The elements are sorted descending according to their natural sort order.
*
* @param fromIndex the start of the range (inclusive) to sort.
* @param toIndex the end of the range (exclusive) to sort.
*
* @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.
* @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].
*/
@SinceKotlin("1.4")
@ExperimentalUnsignedTypes
@@ -4020,6 +4086,12 @@ public fun UIntArray.sortDescending(fromIndex: Int, toIndex: Int): Unit {
/**
* Sorts elements of the array in the specified range in-place.
* The elements are sorted descending according to their natural sort order.
*
* @param fromIndex the start of the range (inclusive) to sort.
* @param toIndex the end of the range (exclusive) to sort.
*
* @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.
* @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].
*/
@SinceKotlin("1.4")
@ExperimentalUnsignedTypes
@@ -4031,6 +4103,12 @@ public fun ULongArray.sortDescending(fromIndex: Int, toIndex: Int): Unit {
/**
* Sorts elements of the array in the specified range in-place.
* The elements are sorted descending according to their natural sort order.
*
* @param fromIndex the start of the range (inclusive) to sort.
* @param toIndex the end of the range (exclusive) to sort.
*
* @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.
* @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].
*/
@SinceKotlin("1.4")
@ExperimentalUnsignedTypes
@@ -4042,6 +4120,12 @@ public fun UByteArray.sortDescending(fromIndex: Int, toIndex: Int): Unit {
/**
* Sorts elements of the array in the specified range in-place.
* The elements are sorted descending according to their natural sort order.
*
* @param fromIndex the start of the range (inclusive) to sort.
* @param toIndex the end of the range (exclusive) to sort.
*
* @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.
* @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].
*/
@SinceKotlin("1.4")
@ExperimentalUnsignedTypes