1
我有對象的列表如下集團通過在Groovy
[["GX 470","Model"],["Lexus","Make"],["Jeep","Make"],["Red","Color"],["blue","Color"]]
,我想將它轉化爲
{"Model":["GX 470"],"Make":["Lexus","Jeep"],"Color":["Red", "blue"]}
我試圖
list.groupBy{ it[1] }
但是,返回我
{"Model":[["GX 470","Model"]],"Make":[["Lexus","Make"],["Jeep","Make"]],"Color":[["Red","Color"],["blue","Color"]]}