Logo

Programming-Idioms

This language bar is your friend. Select your favorite languages!

Idiom #334 Combine 2 maps

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.

final c = {...a, ...b};

Spread and flatten the entries of maps a and b to construct a new copy as c. Duplicate keys will favor b over a.

New implementation...
< >
programming-idioms.org