📜  从列表 kotlin 代码示例创建地图

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

代码示例2
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 }))
}