Quick question: Why does
val map = HashMap<String, ArrayList<String>>().withDefault { arrayListOf() }
map["foo"]!!.add("bar")
compile fine, but
val map = HashMap<String, List<String>>().withDefault { arrayListOf() }
map["foo"]!!.add("bar")
does not? The only difference is ArrayList vs List in the HashMap declaration. As the List interface has “add”, why can’t I call it and get a compiler error instead?