I have two maps like this:
map1 = new Map();
map2 = new Map();
MyObject {
Integer mark1;
Integer mark2
Here is what I think would work
Map map3 = new HashMap<>(map1);
map2.forEach(
(key, value) -> map3.merge(key, value, (v1, v2) -> new MyObject(v1.mark1,v2.mark2))
);
The merge function is what is taking care of your scenario 3, in that if the key already exists, it creates a new MyObject with v1.mark1 and v2.mark2