The builder APIs are still experimental but they are intended to address these sort of use cases.
fun main() {
val orig = listOf(1, 2, 3)
val transformed = buildSet {
orig.mapTo(this) { it * 2 }
}
println(transformed)
}
The builder APIs are still experimental but they are intended to address these sort of use cases.
fun main() {
val orig = listOf(1, 2, 3)
val transformed = buildSet {
orig.mapTo(this) { it * 2 }
}
println(transformed)
}