Reputation: 1093
I am trying to merge many lists into a single list in a gsp. For example:
Class A has a list of class B instances
When i try using the expression: ${a.findAll(some_condition).b}
i am getting a list of lists of instances of B
I would like the expression to return a single list, with all instances of b
belonging to every a
that satisfies some_condition
Upvotes: 2
Views: 778
Reputation: 171074
Can you try:
${a.findAll(some_condition).b.flatten()}
That should get you a single list
${a.findAll(some_condition).b.flatten().unique()}
Should also remove duplicates
Upvotes: 2