Suppose I had a two maps region1, region2 and both are declared as
LinkedHashMap<String, List<String>> region1 = new LinkedHashMap<>();
LinkedHashMap<String, List<String>> region2 = new LinkedHashMap<>();
region1 contains the below values:
region1 : {R1 = [A, B, C, D]}
region2 contains the below values:
region2 : {R2 = [G, A, D, B]}
Considering the values of region1 as base values, iterate over the values of region2 and the non duplicate values must be placed in another map with the key of region2 and non duplicate value of region2.
So the map region3 contains
region3 : {R2 = [G]}
And we iterate region3 over another map comparing for the matched values
map1 : {1 = [G, C]}
Since there is match in the value, we need to add a blank space in the matched value.
So the map1 contains values
map1 : {1=[ , C]}