splat operator in groovy?
- by IttayD
def foo(map, name) {
println(map)
}
foo("bar", hi: "bye")
will print
[hi:bye]
Now I have a previous map that I wish to pass along to foo. In pseudo code, something like:
def otherMap = [hi: "world"]
foo("bar", hi: "bye", otherMap*)
So that it prints
[hi:world]
This doesn't work of course.
Also, trying to pass just the map mixes the order of arguments:
def otherMap = [hi: "world"]
foo("bar", otherMap)
will print
bar
How can I fix this?