Groovy web console

subscribe to the feed Subscribe
to this
site
invert Map (via #groovywebconsole)
tweet this snippet Tweet
this
script

invert Map

Published 9 months ago by Bernie
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
Map m = [a: 1, b: 2] 
Map mInvert = m.collectEntries { e -> [(e.value): e.key] }