Common Array.fill for unsigned arrays, improve docs, native impl name
KT-32359
This commit is contained in:
@@ -1377,7 +1377,13 @@ internal fun CharArray.copyOfRangeImpl(fromIndex: Int, toIndex: Int): CharArray
|
||||
}
|
||||
|
||||
/**
|
||||
* Fills original array with the provided value.
|
||||
* 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.
|
||||
*
|
||||
* @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<T>.fill(element: T, fromIndex: Int = 0, toIndex: Int = size): Unit {
|
||||
@@ -1385,7 +1391,13 @@ public actual fun <T> Array<T>.fill(element: T, fromIndex: Int = 0, toIndex: Int
|
||||
}
|
||||
|
||||
/**
|
||||
* Fills original array with the provided value.
|
||||
* 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.
|
||||
*
|
||||
* @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 ByteArray.fill(element: Byte, fromIndex: Int = 0, toIndex: Int = size): Unit {
|
||||
@@ -1393,7 +1405,13 @@ public actual fun ByteArray.fill(element: Byte, fromIndex: Int = 0, toIndex: Int
|
||||
}
|
||||
|
||||
/**
|
||||
* Fills original array with the provided value.
|
||||
* 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.
|
||||
*
|
||||
* @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 ShortArray.fill(element: Short, fromIndex: Int = 0, toIndex: Int = size): Unit {
|
||||
@@ -1401,7 +1419,13 @@ public actual fun ShortArray.fill(element: Short, fromIndex: Int = 0, toIndex: I
|
||||
}
|
||||
|
||||
/**
|
||||
* Fills original array with the provided value.
|
||||
* 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.
|
||||
*
|
||||
* @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 IntArray.fill(element: Int, fromIndex: Int = 0, toIndex: Int = size): Unit {
|
||||
@@ -1409,7 +1433,13 @@ public actual fun IntArray.fill(element: Int, fromIndex: Int = 0, toIndex: Int =
|
||||
}
|
||||
|
||||
/**
|
||||
* Fills original array with the provided value.
|
||||
* 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.
|
||||
*
|
||||
* @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 LongArray.fill(element: Long, fromIndex: Int = 0, toIndex: Int = size): Unit {
|
||||
@@ -1417,7 +1447,13 @@ public actual fun LongArray.fill(element: Long, fromIndex: Int = 0, toIndex: Int
|
||||
}
|
||||
|
||||
/**
|
||||
* Fills original array with the provided value.
|
||||
* 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.
|
||||
*
|
||||
* @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 FloatArray.fill(element: Float, fromIndex: Int = 0, toIndex: Int = size): Unit {
|
||||
@@ -1425,7 +1461,13 @@ public actual fun FloatArray.fill(element: Float, fromIndex: Int = 0, toIndex: I
|
||||
}
|
||||
|
||||
/**
|
||||
* Fills original array with the provided value.
|
||||
* 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.
|
||||
*
|
||||
* @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 DoubleArray.fill(element: Double, fromIndex: Int = 0, toIndex: Int = size): Unit {
|
||||
@@ -1433,7 +1475,13 @@ public actual fun DoubleArray.fill(element: Double, fromIndex: Int = 0, toIndex:
|
||||
}
|
||||
|
||||
/**
|
||||
* Fills original array with the provided value.
|
||||
* 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.
|
||||
*
|
||||
* @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 BooleanArray.fill(element: Boolean, fromIndex: Int = 0, toIndex: Int = size): Unit {
|
||||
@@ -1441,7 +1489,13 @@ public actual fun BooleanArray.fill(element: Boolean, fromIndex: Int = 0, toInde
|
||||
}
|
||||
|
||||
/**
|
||||
* Fills original array with the provided value.
|
||||
* 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.
|
||||
*
|
||||
* @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 CharArray.fill(element: Char, fromIndex: Int = 0, toIndex: Int = size): Unit {
|
||||
|
||||
@@ -257,43 +257,3 @@ public fun UShortArray.binarySearch(element: UShort, fromIndex: Int = 0, toIndex
|
||||
return -(low + 1) // key not found
|
||||
}
|
||||
|
||||
/**
|
||||
* Fills original array with the provided value.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
@ExperimentalUnsignedTypes
|
||||
@Suppress("ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS")
|
||||
public actual fun UIntArray.fill(element: UInt, fromIndex: Int = 0, toIndex: Int = size): Unit {
|
||||
storage.fill(element.toInt(), fromIndex, toIndex)
|
||||
}
|
||||
|
||||
/**
|
||||
* Fills original array with the provided value.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
@ExperimentalUnsignedTypes
|
||||
@Suppress("ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS")
|
||||
public actual fun ULongArray.fill(element: ULong, fromIndex: Int = 0, toIndex: Int = size): Unit {
|
||||
storage.fill(element.toLong(), fromIndex, toIndex)
|
||||
}
|
||||
|
||||
/**
|
||||
* Fills original array with the provided value.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
@ExperimentalUnsignedTypes
|
||||
@Suppress("ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS")
|
||||
public actual fun UByteArray.fill(element: UByte, fromIndex: Int = 0, toIndex: Int = size): Unit {
|
||||
storage.fill(element.toByte(), fromIndex, toIndex)
|
||||
}
|
||||
|
||||
/**
|
||||
* Fills original array with the provided value.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
@ExperimentalUnsignedTypes
|
||||
@Suppress("ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS")
|
||||
public actual fun UShortArray.fill(element: UShort, fromIndex: Int = 0, toIndex: Int = size): Unit {
|
||||
storage.fill(element.toShort(), fromIndex, toIndex)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user