Join Slack
Communities
Powered by
One use case for my "withDefault" would be a map a...
# getting-started
n
nkiesel
02/23/2017, 10:33 AM
One use case for my "withDefault" would be a map as a "hit counter":
val count = mutableMapOf<String, Int>(); count["a"] = (count["a"] ?: 0) + 1
is the best I can come up with. (Of course I could create a real Count class, but that's besides the point).
Open in Slack
Previous
Next