createHashMapFromArray: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "\| *s([0-9]) *=([^ ]+) *\{\{Since\|(.+)\|([0-9]\.[0-9][02468])[^ ]+\}\} " to "|s$1= $2 |s$1since= $3 $4 ")
m (Text replacement - " \|([ps][0-9]+) *= " to " |$1= ")
Line 16: Line 16:
|r1= [[HashMap]]
|r1= [[HashMap]]


|s2= keys [[createHashMapFromArray]] values
|s2= keys [[createHashMapFromArray]] values


|s2since= arma3 2.04
|s2since= arma3 2.04

Revision as of 00:30, 11 August 2021

Hover & click on the images for description

Description

Description:
Creates a new HashMap and initializes it from a key-value pair array
Groups:
HashMap

Syntax

Syntax:
createHashMapFromArray [[key1, value1], [key2, value2]]
Parameters:
key: HashMapKey
value: Anything
Return Value:
HashMap

Alternative Syntax

Syntax:
keys createHashMapFromArray values
Parameters:
keys: Array - Array of HashMapKeys
values: Array - Array of anything
Size of keys and size of values arrays do not need to be equal. Missing values will be filled with nil.
Return Value:
HashMap

Examples

Example 1:
createHashMapFromArray [["a",1], ["b",2], ["c",3]];
Example 2:
[1,2,3,4] createHashMapFromArray [];// Returns [[1,<null>],[2,<null>],[4,<null>],[3,<null>]]
Example 3:
[1,2,3] createHashMapFromArray ["one","two","three","four"];// Returns [[1,"one"],[2,"two"],[3,"three"]]

Additional Information

See also:
createHashMap

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