I'm struggling to reduce a List of Maps to a single Map using Vavr
<List<Map<String, Object>>>
to
<Map<String, Object>>
I tried it with flatmap/reduce/merge but unfortunately with no happy end :-(
Can someone provided an example how to do it with io.vavr.collection.List/io.vavr.collection.Map ?
I have no idea what vavr has to do with this.
[A] Now you have a stream of
Map<String, Object>.[B] Now you have a stream of map entries. Now you have a stream of key/value pairs.
Then just collect them into a map by providing a function to extract a key from a
Map.Entryobject, and a function that extracts a value.Note that if you have a map of type
Map<String, Object>, I give it 99% odds you're doing something wrong. Java is nominally, statically, and strongly typed, after all.