Kotlin Empty Map

[Solved] Kotlin Empty Map | Kotlin - Code Explorer | yomemimo.com
Question : kotlin empty map

Answered by : simon-walker

/* MUTABLE MAPS
*/
val map = mutableMapOf<String, Int>()

Source : | Last Update : Thu, 26 May 22

Question : kotlin empty map

Answered by : simon-walker

/* IMMUTABLE MAPS
*/
val map = emptyMap<String, Int>()
println("map.isEmpty() is ${map.isEmpty()}") // true
val anotherMap = mapOf<String, Int>()
// Empty maps are equal
println("map == anotherMap is ${map == anotherMap}") // true

Source : https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/empty-map.html | Last Update : Thu, 26 May 22

Answers related to kotlin empty map

Code Explorer Popular Question For Kotlin