Logo

Programming-Idioms

Create the new map c containing all of the (key, value) entries of the two maps a and b.

Explain what happens for keys existing in both a and b.
New implementation

Be concise.

Be useful.

All contributions dictatorially edited by webmasters to match personal tastes.

Please do not paste any copyright violating material.

Please try to avoid dependencies to third-party libraries and frameworks.

Other implementations
final c = {...a, ...b};
c := make(M, len(a)+len(b))
for k, v := range a {
	c[k] = v
}
for k, v := range b {
	c[k] = v
}
let c = {...a, ...b}
%c = (%a, %b);
c = {**a, **b}
c = a.merge(b)