I have a map containing keys that map to a list of...
# announcements
f
I have a map containing keys that map to a list of stuff. I want to iterate all keys of that map and use all entries for each key (a list of stuff) to yield an object that I then collect into a big list of objects. How to I do that? Its
Map<Int, List<Stuff>> -> List<NewStuff>
where new stuff is yielded from each list of stuff
a
map.entries.map { /*convert it.value into List<NewStuff> */ }.flatMap { it }
f
Is an
entry
every key for a map? In that case can’t you just do
map.flatMap { /*convert it into NewStuff */  }
a
yes,
Map
actual has a
.flatMap
that does what you want