07/02/2022, 12:31 PM
How to iterate over a Map in Kotlin So I am new to Kotlin and I am wondering what's the standard way of iterating a Map. I have tried different ways and all of them seem to work, but I don't know if there's one better than the rest or there are some differences that I am not aware of. var mutMap = mutableMapOf("one" to 1, "two" to 2, "tree" to 3, "four" to 4, "five" to 5) mutMap.forEach { entry -> println(entry) } mutMap.iterator().forEach { entry -> println(entry) } mutMap.entries.forEach { entry ->...