Does Map.merge() not replace identical keys?

Hi. I was wondering whether this behavior is intended or not.
Using:

var map1 = DOpus.NewMap('val','val1','nn','val3');
var map2 = DOpus.NewMap('val','val2');
map1.merge(map2);
DOpus.Output(map1('val'));	
DOpus.Output(map1('nn'));	

Gives:

I'd expect that when merging two Maps, if they have the same key, it would be replaced, but that doesn't seem to happen.

The manual doesn't specify anything about this.

Thanks.

It has to work one way around or the other. Values already in the main container take priority over ones in the incoming container. (I'll add that to the docs.)

Do the merge the other way around (i.e. map2.merge(map1)) to get the opposite/desired result.

So it merges the content but doesn't replace values if the key already exists?

var map1 = DOpus.NewMap('val','1','nn','3');
var map2 = DOpus.NewMap('val','2');
map2.merge(map1);
DOpus.Output('Map 1 :' + map1.size);
for (var e = new Enumerator(map1); !e.atEnd(); e.moveNext()) {
	DOpus.Output(e.item() + '=' + map1(e.item()));
}	
DOpus.Output('Map 2 :' + map2.size);
for (var e = new Enumerator(map2); !e.atEnd(); e.moveNext()) {
	DOpus.Output(e.item() + '=' + map2(e.item()));
}

I thought that map2('val') would change its value to "1" (or map1('val') to "2" if doing map1.merge(map2)). But it's good to know it doesn't work that way. Thanks!