fill

Common
JVM
JS
Native
1.0
fun < T > Array < T > . fill (
element : T ,
fromIndex : Int = 0 ,
toIndex : Int = size )

(Common source) (JVM source) (JS source) (Native source)
fun ByteArray . fill (
element : Byte ,
fromIndex : Int = 0 ,
toIndex : Int = size )

(Common source) (JVM source) (JS source) (Native source)
fun ShortArray . fill (
element : Short ,
fromIndex : Int = 0 ,
toIndex : Int = size )

(Common source) (JVM source) (JS source) (Native source)
fun IntArray . fill (
element : Int ,
fromIndex : Int = 0 ,
toIndex : Int = size )

(Common source) (JVM source) (JS source) (Native source)
fun LongArray . fill (
element : Long ,
fromIndex : Int = 0 ,
toIndex : Int = size )

(Common source) (JVM source) (JS source) (Native source)
fun FloatArray . fill (
element : Float ,
fromIndex : Int = 0 ,
toIndex : Int = size )

(Common source) (JVM source) (JS source) (Native source)
fun DoubleArray . fill (
element : Double ,
fromIndex : Int = 0 ,
toIndex : Int = size )

(Common source) (JVM source) (JS source) (Native source)
fun BooleanArray . fill (
element : Boolean ,
fromIndex : Int = 0 ,
toIndex : Int = size )

(Common source) (JVM source) (JS source) (Native source)
fun CharArray . fill (
element : Char ,
fromIndex : Int = 0 ,
toIndex : Int = size )

(Common source) (JVM source) (JS source) (Native source)

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

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.

Exceptions

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

IllegalArgumentException - if fromIndex is greater than toIndex .

Common
JVM
JS
Native
1.3
@ExperimentalUnsignedTypes fun UIntArray . fill (
element : UInt ,
fromIndex : Int = 0 ,
toIndex : Int = size )

(source)
@ExperimentalUnsignedTypes fun ULongArray . fill (
element : ULong ,
fromIndex : Int = 0 ,
toIndex : Int = size )

(source)
@ExperimentalUnsignedTypes fun UByteArray . fill (
element : UByte ,
fromIndex : Int = 0 ,
toIndex : Int = size )

(source)
@ExperimentalUnsignedTypes fun UShortArray . fill (
element : UShort ,
fromIndex : Int = 0 ,
toIndex : Int = size )

(source)

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

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.

Exceptions

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

IllegalArgumentException - if fromIndex is greater than toIndex .

Common
JVM
JS
Native
1.2

Fills the list with the provided value .

Each element in the list gets replaced with the value .