Maps - Put all key
Inserts all key - value pairs into the specified map variable, if key(s) already present in the map-variable the key's associated value is replaced with new value.
Syntax
<target-map variable>.put(<source-map-variable>);
|
where,
<target-map variable> is a map variable in which the action take place
<source-map-variable>
is a map variable from where all the key-value mappings will be added
to the above target map variable
Example
In the following sample code, the key-value mappings in map2 is added
to map1.
actions { on add { on load { map1 = map(); map1.put("John", "India"); map1.put("David", "USA"); map2 = map(); map2.put("Linda", "UK"); map1.put(map2); }
|