In logic, a
HashMap is similar to an
Array but has dimensions that can be either non-consecutive numbers or strings. A HashMap is an
associative array that can be used to store numbers or strings and can dynamically grow or shrink in size.
A HashMap is a CSPro logic object and the following functions can be called via
dot notation:
Function | Description |
clear | Removes all values from the HashMap. |
contains | Returns whether a specified key exists. |
getKeys | Fills a List with the HashMap's keys. |
length | Returns the number of keys. |
remove | Removes a key. |
|
getLabel | Returns the symbol's label. |
getName | Returns the symbol's name. |
getJson | Returns the symbol's metadata and value represented in JSON. |
getValueJson | Returns the symbol's value represented in JSON. |
updateValueFromJson | Modifies the symbol based on a JSON representation of the value. |
HashMap objects can be assigned to other HashMap objects, which will replace the initial HashMap with the values of the assigned HashMap:
hashmap_name = another_hashmap_name;
When assigning a HashMap to another HashMap, both must have the same value types, and the dimension types must be compatible.
Individual elements of HashMap objects can be retrieved or set by using an index to specify the dimension keys:
hashmap_name(key_value1ʃ, key_value2, ...ʅ) = value_to_set_or_modify;
value_to_retrieve = hashmap_name(key_value1ʃ, key_value2, ...ʅ);