getOrDefault
Jump to navigation
Jump to search
Hover & click on the images for descriptions
Description
- Description:
- Retrieves a value out of a HashMap after looking it up by its key. When the HashMap doesn't contain the key, the default value is returned
Syntax
- Syntax:
- hashMap getOrDefault [key, defaultValue]
- Parameters:
- hashMap : HashMap
- key: HashMapKey
- defaultValue: Anything - (Optional, default nil)
- Return Value:
- Anything
Examples
- Example 1:
-
private _myValue = _myHashMap getOrDefault ["a", "Not Found!"];