expandTo

fun <T> MutableList<T>.expandTo(size: Int, value: T)

Expands the list to the specified size by adding the given value to the end of the list until it reaches the target size. If the current size is already greater than or equal to the specified size, the list remains unchanged.

Parameters

size

the target size to expand the list to. Must be non-negative.

value

the element to fill the list with.