map

Returns a list containing the results of applying the given transform function to each element in the original array.

inline fun <T, R> Array<out T>.map(transform: (T) -> R): List<R>(source)
val numbers = arrayOf(1, 2, 3, 4)
val squares = numbers.map { it * it }
println(squares) // prints [1, 4, 9, 16]

Source