如何遍历kotlin中的hasmap?

我是Kotlin新手,在迭代hashmap时遇到了麻烦

typealias HashMap<K, V> = HashMap<K, V> (source) 

这并不难:

 for ((key, value) in map) { println("$key = $value") } 

要么

  map.forEach { key, value -> println("$key = $value") }