📅  最后修改于: 2022-03-11 14:52:43.896000             🧑  作者: Mango
fun max(map:Map) = map.maxByOrNull { it.key }?.key ?:-1//returns negative one if the max is null
fun main(){
var map = mapOf(1 to "hello",2 to "peace", 3 to "ochuko")
println(map.maxByOrNull { it.key }?.key ?:-1)
}