The MapClass
is a class that provides a simple map data structure to store and retrieve key-value pairs. It has methods for adding and updating key-value pairs, removing key-value pairs, checking if a key exists in the map, and retrieving the entire map or individual keys and values. The map also has the ability to be serialized and deserialized.
This method clears the map, setting all key-value pairs to be empty and the length of the map to be 0.
There are no arguments for this method.
This method removes a key-value pair from the map, given a key.
argument name | type | defaultValue | description |
---|---|---|---|
key |
string |
None | The key of the key-value pair to be removed from the map. |
This method adds or updates a key-value pair in the map.
argument name | type | defaultValue | description |
---|---|---|---|
key |
string |
None | The key of the key-value pair to be added or updated in the map. |
value |
dynamic |
None | The value of the key-value pair to be added or updated in the map. |
This method adds all key-value pairs from another map or an associative array to the current map.
argument name | type | defaultValue | description |
---|---|---|---|
other |
dynamic |
None | A map object or an associative array containing the key-value pairs to be added to the current map. |
This method retrieves the value of a key-value pair from the map, given a key.
argument name | type | defaultValue | description |
---|---|---|---|
key |
string |
None | The key of the key-value pair to retrieve the value for. |
hasKey
This method returns a boolean indicating whether the map has a key-value pair with the given key.
argument name | type | defaultValue | description |
---|---|---|---|
key |
string |
None | The key to check for in the map. |
This method returns the entire map as an associative array.
There are no arguments for this method.
This method returns an array of all the values in the map.
There are no arguments for this method.
This method returns an array of all the keys in the map.
There are no arguments for this method.
This method returns a serialized version of the map as an associative array.
There are no arguments for this method.
This method takes in an associative array and updates the map with the key-value pairs contained in the associative array.
argument name | type | defaultValue | description |
---|---|---|---|
data |
mc.types.assocarray |
None | The associative array containing the key-value pairs to be added or updated in the map. |