collections - Groovy Collect List of Lists -


i have list of lists similar this:

[[name:jfk, enumber:e12365576], [name:connor moore, enumber:e12365575]] 

i know if do:

data.collect {s -> s.enumber} 

i get:

["e12365576", "e12365575"] 

what want end though like:

["e12365576 jfk", "e12365575 connor moore"] //or, if possible below ["e12365576 (jfk)", "e12365575 (connor moore)"] 

i've been looking , haven't found similar me figure out. appreciated, thanks

data.collect {s -> "$s.enumber ($s.name)" } 

or, more precisely

data.collect { "$it.enumber ($it.name)" } 

by using implicit it


Comments

Popular posts from this blog

Email notification in google apps script -

c++ - Difference between pre and post decrement in recursive function argument -

javascript - IE11 incompatibility with jQuery's 'readonly'? -