Created
June 26, 2015 11:36
-
-
Save cmittendorf/4769bfb7d62a90890936 to your computer and use it in GitHub Desktop.
An example for extracting values from a list of Maps
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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