Provide Array.fill in common stdlib
KT-32359
This commit is contained in:
committed by
Ilya Gorbunov
parent
83e422fc3b
commit
1a6069382e
@@ -6338,6 +6338,51 @@ public expect fun BooleanArray.copyOfRange(fromIndex: Int, toIndex: Int): Boolea
|
||||
*/
|
||||
public expect fun CharArray.copyOfRange(fromIndex: Int, toIndex: Int): CharArray
|
||||
|
||||
/**
|
||||
* Fills original array with the provided value.
|
||||
*/
|
||||
public expect fun <T> Array<T>.fill(element: T, fromIndex: Int = 0, toIndex: Int = size): Unit
|
||||
|
||||
/**
|
||||
* Fills original array with the provided value.
|
||||
*/
|
||||
public expect fun ByteArray.fill(element: Byte, fromIndex: Int = 0, toIndex: Int = size): Unit
|
||||
|
||||
/**
|
||||
* Fills original array with the provided value.
|
||||
*/
|
||||
public expect fun ShortArray.fill(element: Short, fromIndex: Int = 0, toIndex: Int = size): Unit
|
||||
|
||||
/**
|
||||
* Fills original array with the provided value.
|
||||
*/
|
||||
public expect fun IntArray.fill(element: Int, fromIndex: Int = 0, toIndex: Int = size): Unit
|
||||
|
||||
/**
|
||||
* Fills original array with the provided value.
|
||||
*/
|
||||
public expect fun LongArray.fill(element: Long, fromIndex: Int = 0, toIndex: Int = size): Unit
|
||||
|
||||
/**
|
||||
* Fills original array with the provided value.
|
||||
*/
|
||||
public expect fun FloatArray.fill(element: Float, fromIndex: Int = 0, toIndex: Int = size): Unit
|
||||
|
||||
/**
|
||||
* Fills original array with the provided value.
|
||||
*/
|
||||
public expect fun DoubleArray.fill(element: Double, fromIndex: Int = 0, toIndex: Int = size): Unit
|
||||
|
||||
/**
|
||||
* Fills original array with the provided value.
|
||||
*/
|
||||
public expect fun BooleanArray.fill(element: Boolean, fromIndex: Int = 0, toIndex: Int = size): Unit
|
||||
|
||||
/**
|
||||
* Fills original array with the provided value.
|
||||
*/
|
||||
public expect fun CharArray.fill(element: Char, fromIndex: Int = 0, toIndex: Int = size): Unit
|
||||
|
||||
/**
|
||||
* Returns the range of valid indices for the array.
|
||||
*/
|
||||
|
||||
@@ -3230,6 +3230,34 @@ public inline fun UShortArray.copyOfRange(fromIndex: Int, toIndex: Int): UShortA
|
||||
return UShortArray(storage.copyOfRange(fromIndex, toIndex))
|
||||
}
|
||||
|
||||
/**
|
||||
* Fills original array with the provided value.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
@ExperimentalUnsignedTypes
|
||||
public expect fun UIntArray.fill(element: UInt, fromIndex: Int = 0, toIndex: Int = size): Unit
|
||||
|
||||
/**
|
||||
* Fills original array with the provided value.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
@ExperimentalUnsignedTypes
|
||||
public expect fun ULongArray.fill(element: ULong, fromIndex: Int = 0, toIndex: Int = size): Unit
|
||||
|
||||
/**
|
||||
* Fills original array with the provided value.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
@ExperimentalUnsignedTypes
|
||||
public expect fun UByteArray.fill(element: UByte, fromIndex: Int = 0, toIndex: Int = size): Unit
|
||||
|
||||
/**
|
||||
* Fills original array with the provided value.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
@ExperimentalUnsignedTypes
|
||||
public expect fun UShortArray.fill(element: UShort, fromIndex: Int = 0, toIndex: Int = size): Unit
|
||||
|
||||
/**
|
||||
* Returns the range of valid indices for the array.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user