I'd like to stream a map with collection using Java 8 streams.
For example, having the following data:
Map<String, Collection<Integer>> data;
I'd like to go over the elements handling each integer value with the corresponding key strings. For example:
data.keyValueStream((k,v)-> ...)
Any idea how to achieve this? Thanks.
* Regarding the question "Why do you need it?", it could be a bunch of reasons and I'm not sure it's important. Anyhow, I'll "flow" with you... My specific scenario is to batch insert into a DB all the values, under their specific key. Let's keep it a general Java 8 stream question...