fill

fun UIntArray.fill(element: UInt, fromIndex: Int = 0, toIndex: Int = size)(source)
fun ULongArray.fill(element: ULong, fromIndex: Int = 0, toIndex: Int = size)(source)
fun UByteArray.fill(element: UByte, fromIndex: Int = 0, toIndex: Int = size)(source)
fun UShortArray.fill(element: UShort, fromIndex: Int = 0, toIndex: Int = size)(source)
expect fun <T> Array<T>.fill(element: T, fromIndex: Int = 0, toIndex: Int = size)(source)
expect fun ByteArray.fill(element: Byte, fromIndex: Int = 0, toIndex: Int = size)(source)
expect fun ShortArray.fill(element: Short, fromIndex: Int = 0, toIndex: Int = size)(source)
expect fun IntArray.fill(element: Int, fromIndex: Int = 0, toIndex: Int = size)(source)
expect fun LongArray.fill(element: Long, fromIndex: Int = 0, toIndex: Int = size)(source)
expect fun FloatArray.fill(element: Float, fromIndex: Int = 0, toIndex: Int = size)(source)
expect fun DoubleArray.fill(element: Double, fromIndex: Int = 0, toIndex: Int = size)(source)
expect fun BooleanArray.fill(element: Boolean, fromIndex: Int = 0, toIndex: Int = size)(source)
expect fun CharArray.fill(element: Char, fromIndex: Int = 0, toIndex: Int = size)(source)

Fills this array or its subrange with the specified element value.

Since Kotlin

1.3

Parameters

fromIndex

the start of the range (inclusive) to fill, 0 by default.

toIndex

the end of the range (exclusive) to fill, size of this array by default.

Throws

if fromIndex is less than zero or toIndex is greater than the size of this array.


expect fun <T> MutableList<T>.fill(value: T)(source)

Since Kotlin

1.2
actual fun <T> Array<T>.fill(element: T, fromIndex: Int = 0, toIndex: Int = size)(source)
actual fun ByteArray.fill(element: Byte, fromIndex: Int = 0, toIndex: Int = size)(source)
actual fun ShortArray.fill(element: Short, fromIndex: Int = 0, toIndex: Int = size)(source)
actual fun IntArray.fill(element: Int, fromIndex: Int = 0, toIndex: Int = size)(source)
actual fun LongArray.fill(element: Long, fromIndex: Int = 0, toIndex: Int = size)(source)
actual fun FloatArray.fill(element: Float, fromIndex: Int = 0, toIndex: Int = size)(source)
actual fun DoubleArray.fill(element: Double, fromIndex: Int = 0, toIndex: Int = size)(source)
actual fun BooleanArray.fill(element: Boolean, fromIndex: Int = 0, toIndex: Int = size)(source)
actual fun CharArray.fill(element: Char, fromIndex: Int = 0, toIndex: Int = size)(source)

Fills this array or its subrange with the specified element value.

Since Kotlin

1.3

Parameters

fromIndex

the start of the range (inclusive) to fill, 0 by default.

toIndex

the end of the range (exclusive) to fill, size of this array by default.

Throws

if fromIndex is less than zero or toIndex is greater than the size of this array.


actual fun <T> MutableList<T>.fill(value: T)(source)

Fills the list with the provided value.

Each element in the list gets replaced with the value.

Since Kotlin

1.2
actual fun <T> Array<T>.fill(element: T, fromIndex: Int = 0, toIndex: Int = size)(source)
actual fun ByteArray.fill(element: Byte, fromIndex: Int = 0, toIndex: Int = size)(source)
actual fun ShortArray.fill(element: Short, fromIndex: Int = 0, toIndex: Int = size)(source)
actual fun IntArray.fill(element: Int, fromIndex: Int = 0, toIndex: Int = size)(source)
actual fun LongArray.fill(element: Long, fromIndex: Int = 0, toIndex: Int = size)(source)
actual fun FloatArray.fill(element: Float, fromIndex: Int = 0, toIndex: Int = size)(source)
actual fun DoubleArray.fill(element: Double, fromIndex: Int = 0, toIndex: Int = size)(source)
actual fun BooleanArray.fill(element: Boolean, fromIndex: Int = 0, toIndex: Int = size)(source)
actual fun CharArray.fill(element: Char, fromIndex: Int = 0, toIndex: Int = size)(source)

Fills this array or its subrange with the specified element value.

Since Kotlin

1.0

Parameters

fromIndex

the start of the range (inclusive) to fill, 0 by default.

toIndex

the end of the range (exclusive) to fill, size of this array by default.

Throws

if fromIndex is less than zero or toIndex is greater than the size of this array.


actual inline fun <T> MutableList<T>.fill(value: T)(source)

Fills the list with the provided value.

Each element in the list gets replaced with the value.

Since Kotlin

1.2
actual fun <T> Array<T>.fill(element: T, fromIndex: Int = 0, toIndex: Int = size)(source)
actual fun ByteArray.fill(element: Byte, fromIndex: Int = 0, toIndex: Int = size)(source)
actual fun ShortArray.fill(element: Short, fromIndex: Int = 0, toIndex: Int = size)(source)
actual fun IntArray.fill(element: Int, fromIndex: Int = 0, toIndex: Int = size)(source)
actual fun LongArray.fill(element: Long, fromIndex: Int = 0, toIndex: Int = size)(source)
actual fun FloatArray.fill(element: Float, fromIndex: Int = 0, toIndex: Int = size)(source)
actual fun DoubleArray.fill(element: Double, fromIndex: Int = 0, toIndex: Int = size)(source)
actual fun BooleanArray.fill(element: Boolean, fromIndex: Int = 0, toIndex: Int = size)(source)
actual fun CharArray.fill(element: Char, fromIndex: Int = 0, toIndex: Int = size)(source)

Fills this array or its subrange with the specified element value.

Since Kotlin

1.3

Parameters

fromIndex

the start of the range (inclusive) to fill, 0 by default.

toIndex

the end of the range (exclusive) to fill, size of this array by default.

Throws

if fromIndex is less than zero or toIndex is greater than the size of this array.


actual fun <T> MutableList<T>.fill(value: T)(source)

Fills the list with the provided value.

Each element in the list gets replaced with the value.

Since Kotlin

1.3