我正在给柯特林打电话,我遇到了一个小问题,我解决不了. 当我具有以下 struct 时,我可以将元素放入 map 中:
val map = HashMap<String, String>()
map["asd"] = "s"
map.put("34", "354")
然而,当我用Map
界面创建 map 时,我只能读取它们,我做错了什么?
val map: Map<String, String> = HashMap<String, String>();
map.put("24", "34") //error
map["23"] = "23" //error
Or maybe I'm confusing something about interfaces in Kotlin ?