我有一个记录
["name1":["value1":10, "value2":name1, "value3":150, "value4":20],
"name2":["value1":10, "value2":name2, "value3":150, "value4":20]]
我有一个列表,其中的值是name1, name2
等
我想根据的名称1提取列表
["name1":["value1":10, "value2":name1, "value3":150, "value4":20]]
subMap(["name1"])确实对我有用,但我有一个列表,通过循环该列表,我需要提取值
Ex : namesList.each{record ->
newMap = firstmap.subMap(record)
}
使用subMap(集合密钥):
def map = ["name1":["value1":10, "value2":"name1", "value3":150, "value4":20],
"name2":["value1":10, "value2":"name2", "value3":150, "value4":20]]
//Answer here, return Map still:
println map.subMap("name1")
//Or
println map.subMap(["name1", "name2"])