Why is MapWithDefault private?
I like to use .withDefault on maps. Today I wanted to write a class containing some mapping of values and wanted to be sure every instance of such class will also define a default mapping. Example of such mapping:
mapOf(
"w" to Gender.FEMALE,
"m" to Gender.MALE,
"u" to Gender.UNKNOWN
).withDefault { Gender.UNKNOWN }
The simple idea to ensure that default value for the map is always set was to use MapWithDefault as the type of my property:
val genderMapping: MapWithDefault
But both...