Kotlin 2 · Collections and lambdas
Transform and filter
Chain operations on collections with lambdas. it names a single parameter.
val lengths = names.map { it.length }
val short = names.filter { it.length <= 3 }
val total = ages.values.sum()
Official Kotlin 2 documentation