Description
Retrieves a value from the HashMap for the given 'key', executes given 'code' if key was not found and returns result. Additionally sets key to the code result value if set is true.
Syntax
hashMap getOrDefaultCall [key, code, set]
Parameters:
hashMap: HashMapkey: HashMapKey - case-sensitive keycode: Code - (Optional, default nil) code to execute if the key does not existset: Boolean - (Optional, default false) if true and value does not exist in the provided hash map, the result of the code execution is added to the hash map
Returns: Anything
Examples
Example 1
_hashmap getOrDefaultCall [123, { systemChat "The key 123 does not exist and will be created and assigned 345"; 345 }, true];
See also
getOrDefault · HashMap · get