📜  如何在 kotlin 代码示例中创建地图

📅  最后修改于: 2022-03-11 14:53:34.344000             🧑  作者: Mango

代码示例3
fun main() {
    val numbers = listOf("one", "two", "three", "four")

    println(numbers.associateBy { it.first().toUpperCase() })
    println(numbers.associateBy(keySelector = { it.first().toUpperCase() }, valueTransform = { it.length }))
}