Is there a way to not have to say !! here?
# getting-started
b
Is there a way to not have to say !! here?
s
the easy answer is
map1[it.key] = map1.getValue(it.key) + it.value
but you’ll still be able to make this more concise
b
oh I could do a getValue with a default of 0.0 as well
s
Copy code
for ((key, value) in map2) {
  this[key] = getOrDefault(key) { 0 } + value
}
👍 1
b
also I realized that my map1=this is a mistake as I don't want to touch the original object