putAll()
Table of Contents
Overview
The putAll() function takes mapVariableOne and mapVariableTwo as arguments, and adds all key-value pairs present in mapVariableTwo to mapVariableOne.
Syntax
<mapVariableOne>.putAll( <mapVariableTwo> );
Parameter | Description | Data type |
---|---|---|
<mapVariableOne> | The map variable to which the key-value pairs will be added. | KEY-VALUE |
<mapVariableTwo> | The map variable from which the value will be returned. If a duplicate key is specified, its new value will overwrite the existing value in mapVariable1, and the new key-value pair will not get added. /td> | KEY-VALUE |
Examples
mapOne= {"Product" : "Creator", "Version" : 5};
mapTwo= {"Company": "Zoho", "Country" : "India"};
mapOne.putAll(mapTwo); // Now mapOne will contain {"Product" : "Creator", "Version" : 5 ,"Company": "Zoho", "Country" : "India"}
mapTwo= {"Company": "Zoho", "Country" : "India"};
mapOne.putAll(mapTwo); // Now mapOne will contain {"Product" : "Creator", "Version" : 5 ,"Company": "Zoho", "Country" : "India"}