How could I do something like `flatMapValues` to a...
# announcements
d
How could I do something like
flatMapValues
to a map? All that currently exists is
mapValues
... My use case is a json hierarchy that needs to be flattened into a
Map<String, Map<String, JsonElement>>
. It's something like
{ "level1": { "ns": { "s1": "", "s2": "" } } }
, and needs to be
[level1 = [ ns.s1 = "", ns.s2 = ""]]
. And it's using Gson's JsonObject, etc...
s
might help to figure out exactly what kind of transform you’re looking for first
type-wise I mean
d
In the current mapValues, I can only generate one value per entry, but I would like to be able to generate multiple values per entry and flatten the result into one map (by concatenating the 2nd and 3rd level keys).