I have a map of List for custom wrapper object records as below

Map<String, List<Custom wrapper object>>

I want to get all the records in one list together irrespective of the key of map.

How can this be achieved?

1 Answer 1


It's a pretty simple structure to flatten.

List<MyWrapper> flattened = new List<MyWrapper>();
for (List<MyWrapper> collection : myMap.values())

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .