2
def foo(map, name) {
println(map)
}
foo("bar", hi: "bye")
[hi:bye]
現在我有一個以前的地圖,我想一起FOO通過。在僞代碼,類似:
def otherMap = [hi: "world"]
foo("bar", hi: "bye", otherMap*)
所以它打印
[hi:world]
當然,這是行不通的。
此外,試圖通過剛剛地圖混合參數的順序:
def otherMap = [hi: "world"]
foo("bar", otherMap)
將打印
bar
我該如何解決這個問題?
你怎麼能指望'FOO( 「酒吧」,otherMap)'打印的東西比'bar'別的嗎?您正在打印第一個參數。 – Geo 2010-05-31 09:43:24