Document fromIndex and toIndex parameters #KT-38388
This commit is contained in:
committed by
Abduqodiri Qurbonzoda
parent
9d8299f764
commit
75b98ab7c5
@@ -1380,8 +1380,11 @@ public actual 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].
|
||||
*/
|
||||
public actual fun <T> Array<T>.copyOfRange(fromIndex: Int, toIndex: Int): Array<T> {
|
||||
checkCopyOfRangeArguments(fromIndex, toIndex, size)
|
||||
@@ -1391,8 +1394,11 @@ public actual 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 actual fun ByteArray.copyOfRange(fromIndex: Int, toIndex: Int): ByteArray {
|
||||
checkCopyOfRangeArguments(fromIndex, toIndex, size)
|
||||
@@ -1402,8 +1408,11 @@ public actual 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 actual fun ShortArray.copyOfRange(fromIndex: Int, toIndex: Int): ShortArray {
|
||||
checkCopyOfRangeArguments(fromIndex, toIndex, size)
|
||||
@@ -1413,8 +1422,11 @@ public actual fun ShortArray.copyOfRange(fromIndex: Int, toIndex: Int): ShortArr
|
||||
/**
|
||||
* 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 actual fun IntArray.copyOfRange(fromIndex: Int, toIndex: Int): IntArray {
|
||||
checkCopyOfRangeArguments(fromIndex, toIndex, size)
|
||||
@@ -1424,8 +1436,11 @@ public actual 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 actual fun LongArray.copyOfRange(fromIndex: Int, toIndex: Int): LongArray {
|
||||
checkCopyOfRangeArguments(fromIndex, toIndex, size)
|
||||
@@ -1435,8 +1450,11 @@ public actual 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 actual fun FloatArray.copyOfRange(fromIndex: Int, toIndex: Int): FloatArray {
|
||||
checkCopyOfRangeArguments(fromIndex, toIndex, size)
|
||||
@@ -1446,8 +1464,11 @@ public actual fun FloatArray.copyOfRange(fromIndex: Int, toIndex: Int): FloatArr
|
||||
/**
|
||||
* 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 actual fun DoubleArray.copyOfRange(fromIndex: Int, toIndex: Int): DoubleArray {
|
||||
checkCopyOfRangeArguments(fromIndex, toIndex, size)
|
||||
@@ -1457,8 +1478,11 @@ public actual fun DoubleArray.copyOfRange(fromIndex: Int, toIndex: Int): DoubleA
|
||||
/**
|
||||
* 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 actual fun BooleanArray.copyOfRange(fromIndex: Int, toIndex: Int): BooleanArray {
|
||||
checkCopyOfRangeArguments(fromIndex, toIndex, size)
|
||||
@@ -1468,8 +1492,11 @@ public actual fun BooleanArray.copyOfRange(fromIndex: Int, toIndex: Int): Boolea
|
||||
/**
|
||||
* 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 actual fun CharArray.copyOfRange(fromIndex: Int, toIndex: Int): CharArray {
|
||||
checkCopyOfRangeArguments(fromIndex, toIndex, size)
|
||||
@@ -1704,8 +1731,8 @@ internal fun CharArray.copyOfUninitializedElements(newSize: 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].
|
||||
@@ -1719,8 +1746,8 @@ public actual 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].
|
||||
@@ -1734,8 +1761,8 @@ public actual 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].
|
||||
@@ -1749,8 +1776,8 @@ public actual 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].
|
||||
@@ -1764,8 +1791,8 @@ public actual 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].
|
||||
@@ -1779,8 +1806,8 @@ public actual 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].
|
||||
@@ -1794,8 +1821,8 @@ public actual 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].
|
||||
@@ -1809,8 +1836,8 @@ public actual 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].
|
||||
@@ -1824,8 +1851,8 @@ public actual 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].
|
||||
@@ -2202,6 +2229,12 @@ public actual 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")
|
||||
@@ -2214,6 +2247,12 @@ public actual 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")
|
||||
@@ -2226,6 +2265,12 @@ public actual 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")
|
||||
@@ -2238,6 +2283,12 @@ public actual 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")
|
||||
@@ -2250,6 +2301,12 @@ public actual 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")
|
||||
@@ -2262,6 +2319,12 @@ public actual 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")
|
||||
@@ -2274,6 +2337,12 @@ public actual 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")
|
||||
@@ -2286,6 +2355,12 @@ public actual 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")
|
||||
@@ -2308,6 +2383,12 @@ public actual 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].
|
||||
*/
|
||||
@Suppress("ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS")
|
||||
public actual fun <T> Array<out T>.sortWith(comparator: Comparator<in T>, fromIndex: Int = 0, toIndex: Int = size): Unit {
|
||||
|
||||
Reference in New Issue
Block a user