Map Merge
The map::merge
function combines two or more maps into a single map. If there are duplicate keys, the values from the latter maps overwrite the earlier ones.
Syntax
map::merge(<map1>, <map2>, ...)
Parameters
map1, map2, ...
: Two or more maps to be merged.
Returns
- Map: A single map containing all key-value pairs from the input maps.
Example
map::merge({"name": "Alice"}, {"age": 30}, {"city": "New York"})
This function is useful for combining multiple maps into one cohesive dataset.