I have data that is like this:
List<Map<String, String>> = // psuedocode
[
{
"ID": "a",
"Value": "val1"
},
{
"ID": "b",
"Value": "val2"
},
]
I want to turn this to
Map<String, String> = // more pseudocode
{
"a": "val1",
"b": "val2"
}
I have something like this so far:
Map<String, String> output = myList.stream()
.flatMap(m -> m.entrySet().stream())
.collect(Collectors.toMap())
Can someone please guide me? The alternative is to use regular for loops, but I am trying to use lambdas.
Map<String, String>into a single key-value pair, basically...