Hi All, i want to know which type of map initialis...
# kotlin-native
d
Hi All, i want to know which type of map initialisation is mostly preferred 1.
map[key] = map.getOrPut(key){ defaultValue} + someOperation
2.
map[key] = map[key]?.let{ it -> someOperation} ?: defaultValue
3.
if(!map.contains(key)) { map.put(key, value) }
c
What is
someOperation
? Where did it go in the last one?
d
someOperations is more like adding or subtracting and in last one code is incomplete.
a
hi @Devanshu Vaidya, this channel is for Kotlin Native, but your question looks like a general Kotlin question. You might get more help in #getting-started.
d
Hey @Adam S, thanks for letting me know