Document fromIndex and toIndex parameters #KT-38388
This commit is contained in:
@@ -1298,8 +1298,11 @@ public actual fun <T> Array<out 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("ACTUAL_WITHOUT_EXPECT")
|
||||
public actual fun <T> Array<out T>.copyOfRange(fromIndex: Int, toIndex: Int): Array<T> {
|
||||
@@ -1310,8 +1313,11 @@ public actual fun <T> Array<out T>.copyOfRange(fromIndex: Int, toIndex: Int): Ar
|
||||
/**
|
||||
* 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 {
|
||||
AbstractList.checkRangeIndexes(fromIndex, toIndex, size)
|
||||
@@ -1321,8 +1327,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 {
|
||||
AbstractList.checkRangeIndexes(fromIndex, toIndex, size)
|
||||
@@ -1332,8 +1341,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 {
|
||||
AbstractList.checkRangeIndexes(fromIndex, toIndex, size)
|
||||
@@ -1343,8 +1355,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 {
|
||||
AbstractList.checkRangeIndexes(fromIndex, toIndex, size)
|
||||
@@ -1354,8 +1369,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 {
|
||||
AbstractList.checkRangeIndexes(fromIndex, toIndex, size)
|
||||
@@ -1365,8 +1383,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 {
|
||||
AbstractList.checkRangeIndexes(fromIndex, toIndex, size)
|
||||
@@ -1376,8 +1397,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 {
|
||||
AbstractList.checkRangeIndexes(fromIndex, toIndex, size)
|
||||
@@ -1387,8 +1411,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 {
|
||||
AbstractList.checkRangeIndexes(fromIndex, toIndex, size)
|
||||
@@ -1398,8 +1425,8 @@ public actual 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].
|
||||
@@ -1414,8 +1441,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].
|
||||
@@ -1430,8 +1457,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].
|
||||
@@ -1446,8 +1473,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].
|
||||
@@ -1462,8 +1489,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].
|
||||
@@ -1478,8 +1505,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].
|
||||
@@ -1494,8 +1521,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].
|
||||
@@ -1510,8 +1537,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].
|
||||
@@ -1526,8 +1553,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].
|
||||
@@ -1849,6 +1876,12 @@ public fun <T> Array<out T>.sort(comparison: (a: T, b: T) -> Int): 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")
|
||||
@@ -1861,6 +1894,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")
|
||||
@@ -1874,6 +1913,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")
|
||||
@@ -1887,6 +1932,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")
|
||||
@@ -1900,6 +1951,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")
|
||||
@@ -1912,6 +1969,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")
|
||||
@@ -1925,6 +1988,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")
|
||||
@@ -1938,6 +2007,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")
|
||||
@@ -2017,6 +2092,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].
|
||||
*/
|
||||
@SinceKotlin("1.4")
|
||||
@Suppress("ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS")
|
||||
|
||||
Reference in New Issue
Block a user