Use java8, is there any concise syntax to merge two maps:
Map<String, Map<String, Set<Long>>> m1
Map<String, Map<String, Set<Long>>> m2
And do not change any element in m1, m2, even change the mergedMap.
For example:
the m1 contains 2 elements which like:
{
"k1": {
"v1": [
11,
12
]
},
"k2": {
"v2": [
21
]
}
}
the m2 contains 3 elements which like:
{
"k1": {
"v11": [
11
]
},
"k2": {
"v2": [
21,
22
]
},
"k3": {
"v3": [
31
]
}
}
The merged map what I want is the merged 3 elements.
Especially, the "k1"'s value combine from m1 and m2.
{
"k1": {
"v1": [
11,
12
],
"v11": [
11
]
},
"k2": {
"v2": [
21,
22
]
},
"k3": {
"v3": [
31
]
}
}
And when I add some elements in the merged Map which key is <"k3", <"v3", ???>>.
I don't want the origin map m2's elements modify any more.