I'm trying to transpose a map so that:
[x: y, w: y, a: b]
becomes
[y: [x, w], b: a]
(all variables are strings) Doing something like
["x": "y", "w": "y", "a": "b"].collectEntries { [it.value, it.key] }
gets me part way, but stomps on the first new value for "y". I only get: [y:w, b:a]
What is the best way to slurp up the new values into an array for their common new key? Thanks for any help or suggestions.