val word: String = "abracadabra"
val freqMap: MutableMap<Char, Int> = HashMap<Char, Int>().withDefault { 0 } word.forEach { freqMap[it] += 1 }
results in this compile time error:
Operator call corresponds to a dot-qualified call 'freq[it].plusAssign(1)' which is not allowed on a nullable receiver 'freq[it]'.
What the hack!?
Why is freq[it] considered Int?
when freqMap
is of type MutableMap<Char, Int>
(Kotlin plugin 1.3.50-release-IJ2019.1.1)