getOrDefault: Difference between revisions
Jump to navigation
Jump to search
Killzone Kid (talk | contribs) No edit summary |
Lou Montana (talk | contribs) m (Text replacement - "(\|[pr][0-9]+ *= *[^-]+) *- *C([a-eg-z])" to "$1 - c$2") |
||
Line 12: | Line 12: | ||
|p1= hashMap: [[HashMap]] | |p1= hashMap: [[HashMap]] | ||
|p2= key: [[HashMapKey]] - | |p2= key: [[HashMapKey]] - case sensitive key | ||
|p3= defaultValue: [[Anything]] - (Optional, default [[nil]]) | |p3= defaultValue: [[Anything]] - (Optional, default [[nil]]) |
Latest revision as of 14:59, 8 November 2023
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
- Groups:
- HashMap
Syntax
- Syntax:
- hashMap getOrDefault [key, defaultValue, setDefault]
- Parameters:
- hashMap: HashMap
- key: HashMapKey - case sensitive key
- defaultValue: Anything - (Optional, default nil)
- since
2.04
- setDefault: Boolean - (Optional, default false) if set to true and value does not exist in provided hash map, defaultValue will be added to the hash map
- Return Value:
- Anything
Examples
- Example 1:
- Example 2:
- Example 3:
Additional Information
- See also:
- getOrDefaultCall HashMap get
Notes
-
Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note