fill
fun ByteArray.fill(
element: Byte,
fromIndex: Int = 0,
toIndex: Int = size)fun ShortArray.fill(
element: Short,
fromIndex: Int = 0,
toIndex: Int = size)fun IntArray.fill(
element: Int,
fromIndex: Int = 0,
toIndex: Int = size)fun LongArray.fill(
element: Long,
fromIndex: Int = 0,
toIndex: Int = size)fun FloatArray.fill(
element: Float,
fromIndex: Int = 0,
toIndex: Int = size)fun DoubleArray.fill(
element: Double,
fromIndex: Int = 0,
toIndex: Int = size)fun BooleanArray.fill(
element: Boolean,
fromIndex: Int = 0,
toIndex: Int = size)fun CharArray.fill(
element: Char,
fromIndex: Int = 0,
toIndex: Int = size)Fills this array or its subrange with the specified element value.
Parameters
fromIndex - the start of the range (inclusive), 0 by default.
toIndex - the end of the range (exclusive), 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.
@ExperimentalUnsignedTypes fun ULongArray.fill(
element: ULong,
fromIndex: Int = 0,
toIndex: Int = size)@ExperimentalUnsignedTypes fun UByteArray.fill(
element: UByte,
fromIndex: Int = 0,
toIndex: Int = size)@ExperimentalUnsignedTypes fun UShortArray.fill(
element: UShort,
fromIndex: Int = 0,
toIndex: Int = size)Fills this array or its subrange with the specified element value.
Parameters
fromIndex - the start of the range (inclusive), 0 by default.
toIndex - the end of the range (exclusive), 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.
fun <T> MutableList<T>.fill(value: T)