【发布时间】:2019-12-26 10:33:05
【问题描述】:
我需要添加一些MutableList<String> 到地图Map<String, List<String>>,这是我尝试初始化它的方式:
private var theSteps: MutableList<String> = mutableListOf()
private var optionsList: Map<String, List<String>> = mapOf()
然后我以这种方式将数据添加到`MutableList:
theSteps.add("one")
theSteps.add("two")
theSteps.add("three")
一切正常,直到我尝试添加到Map:
optionsList.add("list_1" to theSteps)
它只是给了我错误Unresolved reference add,我找不到关于如何向其中添加项目的明确文档。
【问题讨论】:
标签: arrays kotlin hashmap mutablelist