https://kotlinlang.org logo
#announcements
Title
# announcements
k

karelpeeters

06/29/2017, 9:57 PM
When I add a factory for new values to a MutableMap with "withDefault", get() still returns a nullable reference. Is there a way around this?
h

hughg

06/30/2017, 3:28 PM
I was confused by this, too, coming from Groovy. Kotlin devs, would you consider deprecating this method name in favour of, say, withDefaultValue for the "helper method for delegating to a map" and withDefaultPut for a new "helper method for treating get as getOrPut(..., makeDefault())"? I'm not arguing strongly for it - it would just be to avoid confusing Groovy developers :-)
2 Views