resize

fun resize(newSize: Int)

Truncate or expand the list to the new size. If the list is truncated, the buffer will not be reallocated (use .trimToSize if you need a truncated buffer), but the truncated values will be reset to the default value (zero). If the list is expanded, the elements beyond the current size are initialized with JVM-defaults (zero or null values).