fill

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

Since Kotlin

1.2
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