Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save jeffscottbrown/d880b7f73ac5668501d9c9f2dd26217b to your computer and use it in GitHub Desktop.

Select an option

Save jeffscottbrown/d880b7f73ac5668501d9c9f2dd26217b to your computer and use it in GitHub Desktop.
groovy:000> initialMap = [name: 'Jeff', company: 'OCI']
===> [name:Jeff, company:OCI]
groovy:000>
groovy:000> secondMap = initialMap.collectEntries { k, v ->
groovy:001> ["-$k", v]
groovy:002> }
===> [-name:Jeff, -company:OCI]
groovy:000>
groovy:000> println "Initial Map: $initialMap"
Initial Map: [name:Jeff, company:OCI]
===> null
groovy:000> println "Second Map: $secondMap"
Second Map: [-name:Jeff, -company:OCI]
===> null
groovy:000>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment