{"name":"createHashMapFromArray","title":"createHashMapFromArray","type":"command","url":"https://community.bistudio.com/wiki/createHashMapFromArray","revid":377214,"updated":"2026-01-02T00:12:06Z","groups":["HashMap","Arrays"],"status":"ok","games":{"arma3":"2.02"},"since":"arma3 2.02","arma3_since":"2.02","description":"Creates a new HashMap and initializes it from a key-value pair array","syntaxes":[{"syntax":"createHashMapFromArray [[key1, value1], [key2, value2], ...]","params":[{"name":"keyN","type":"HashMapKey","type_expr":"HashMapKey"},{"name":"valueN","type":"Anything","type_expr":"Anything"}],"returns":{"type":"HashMap","type_expr":"HashMap"},"form":"unary","right":{"text":"[[key1, value1], [key2, value2], ...]"}},{"syntax":"keys createHashMapFromArray values","since":"arma3 2.04","params":[{"name":"keys","type":"Array of HashMapKeys","type_expr":"Array<HashMapKey>"},{"name":"values","type":"Array of Anything","description":"Array of Anything\n\n> [!NOTE]\n> Size of *keys* and size of *values* arrays do not need to be equal. Missing values will be filled with nil.","type_expr":"Array<Anything>","text":"values: Array of Anything\n\n> [!NOTE]\n> Size of *keys* and size of *values* arrays do not need to be equal. Missing values will be filled with nil."}],"returns":{"type":"HashMap","type_expr":"HashMap"},"form":"binary","left":{"text":"keys"},"right":{"text":"values"}}],"examples":[{"code":["createHashMapFromArray [[\"a\", 1], [\"b\", 2], [\"c\", 3]];"]},{"code":["[1, 2, 3, 4] createHashMapFromArray []; // returns [[1, <null>], [2, <null>], [4, <null>], [3, <null>]]"]},{"code":["[1, 2, 3] createHashMapFromArray [\"one\", \"two\", \"three\", \"four\"]; // returns [[1, \"one\"], [2, \"two\"], [3, \"three\"]]"]}],"see_also":["createHashMap"]}