MutableList
Creates a new mutable list with the specified size, where each element is calculated by calling the specified init function.
inline fun <T> MutableList(size: Int, init: (index: Int) -> T): MutableList<T>(source)
fun main() {
val squares = MutableList(5) { index -> index * index }
println(squares) // [0, 1, 4, 9, 16]
}