Skip to content

Instantly share code, notes, and snippets.

@cmittendorf
Created June 26, 2015 11:36
Show Gist options
  • Save cmittendorf/4769bfb7d62a90890936 to your computer and use it in GitHub Desktop.
Save cmittendorf/4769bfb7d62a90890936 to your computer and use it in GitHub Desktop.
An example for extracting values from a list of Maps
#!/usr/bin/env groovy
def m = [
nephew1:[name:"Huey", age:10],
nephew2:[name:"Dewey", age:12],
nephew3:[name:"Louie", age:13]
]
println m.collectEntries { [(it.key) : (it.value.name)] }
// [nephew1:Huey, nephew2:Dewey, nephew3:Louie]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment