I am trying to transfer a card 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 partially, but stomps on the first new value for "y". I get only: [y: w, b: a]
What is the best way to expand new values ββinto an array for their shared new key? Thanks for any help or suggestions.
maps transpose groovy
Scott Presnell
source share