I would like to request a command similar to getOrDefault except default value will be calculated from provided code only if provided key is missing.
Primary usage - quick retrieval and caching of values in the hashmap.
I would like to request a command similar to getOrDefault except default value will be calculated from provided code only if provided key is missing.
Primary usage - quick retrieval and caching of values in the hashmap.
Suggested names: getOrCall, getOrDefaultCall
Suggested syntax:
Any = HashMap getOrCall [Key, Code, SetFlag]
Key - HashMap key
Code - Code to call if key is not found
SetFlag - flag to set result of code execution alongside returning it, might be false by default to be in line with getOrDefault command
Code's scope might include key and hashmap in some magic variables (_thisMap, _thisKey) without touching _this, so arguments and local variables from higher scope are still accessible.