在常規的組,我有maps.Each地圖的列表中包含3個鍵與 各自的值,如:如何形成相同值和鍵
def group= [] as DataList def groupRequiredMap = ["a": Metadata.groupName, "b": Metadata.instance, "c": Metadata.color] group << groupRequiredMap
組的輸出被作爲如下::
[[a:apple, b:0, c:red], [a:apple, b:0, c:green], [a:apple, b:0, c:blue], [a:apple, b:1, c:brown], [a:apple, b:1, c:violet], [a:grapes, b:0, c:black], [a:grapes, b:0, c:yellow], [a:grapes, b:1, c:orange], [a:grapes, b:1, c:pink]]
欲形成一組與b = 0,一組用b = 1蘋果蘋果的,一組用b = 0葡萄和一組克用b強姦= 1等等。筆者想輸出是這樣的:
[[a:apple, b:0, c:[red, green, blue]],
[a:apple, b:1, c:[brown,violet]],
[a:grapes, b:0, c:[black,yellow]],
[a:grapes, b:1, c:[orange,pink]]
你堅持了哪一點?你有一些不起作用的代碼嗎? –