merge: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
(Created page)
 
m (updated format)
Line 9: Line 9:
|descr= Merges two [[HashMap|HashMaps]].
|descr= Merges two [[HashMap|HashMaps]].


|s1= map1 [[merge]] map2
|s1= hashMap1 [[merge]] hashMap2


|p1= '''map1''': [[HashMap]] - This HashMap will be modified.
|p1= hashMap1: [[HashMap]] - This HashMap will be modified


|p2= '''map2''': [[HashMap]] - All key-value pairs from this HashMap are added to '''map1'''. If a key from '''map2''' already exists in '''map1''', then its value is overwritten with the corresponding value from '''map2'''.
|p2= hashMap2: [[HashMap]] - All key-value pairs from this HashMap are added to '''hashMap1'''. If a key from '''hashMap2''' already exists in '''hashMap1''', then its value is overwritten with the corresponding value from '''hashMap2'''


|r1= [[Nothing]]
|r1= [[Nothing]]
Line 19: Line 19:
|s2= map1 [[merge]] [map2, overwriteExisting]
|s2= map1 [[merge]] [map2, overwriteExisting]


|p21= '''map1''': [[HashMap]] - This HashMap will be modified.
|p21= hashMap1: [[HashMap]] - This HashMap will be modified


|p22= '''map2''': [[HashMap]] - All key-value pairs from this HashMap are added to '''map1'''.
|p22= hashMap2: [[HashMap]] - All key-value pairs from this HashMap are added to '''hashMap1'''


|p23= '''overwriteExisting''' (Optional, default: [[false]]): [[Boolean]] - If [[true]], keys from '''map1''' that also exist in '''map2''' are overwritten. [[merge]] is faster when this parameter is set to [[true]].
|p23= overwriteExisting (Optional, default: [[false]]): [[Boolean]] - If [[true]], keys from '''hashMap1''' that also exist in '''hashMap2''' are overwritten. [[merge|Merge]] is faster when this parameter is set to [[true]]


|r2= [[Nothing]]
|r2= [[Nothing]]
Line 29: Line 29:
|x1= <code>_hashMap [[merge]] _otherHashMap;</code>
|x1= <code>_hashMap [[merge]] _otherHashMap;</code>


|seealso= [[HashMap]]
|seealso= [[insert]] [[set]]
}}
}}

Revision as of 15:31, 29 January 2021

-wrong parameter ("arma3dev") defined!-[[:Category:Introduced with arma3dev version 2.04|2.04]]
Hover & click on the images for description

Description

Description:
Merges two HashMaps.
Groups:
HashMap

Syntax

Syntax:
hashMap1 merge hashMap2
Parameters:
hashMap1: HashMap - This HashMap will be modified
hashMap2: HashMap - All key-value pairs from this HashMap are added to hashMap1. If a key from hashMap2 already exists in hashMap1, then its value is overwritten with the corresponding value from hashMap2
Return Value:
Nothing

Alternative Syntax

Syntax:
map1 merge [map2, overwriteExisting]
Parameters:
hashMap1: HashMap - This HashMap will be modified
hashMap2: HashMap - All key-value pairs from this HashMap are added to hashMap1
overwriteExisting (Optional, default: false): Boolean - If true, keys from hashMap1 that also exist in hashMap2 are overwritten. Merge is faster when this parameter is set to true
Return Value:
Nothing

Examples

Example 1:
_hashMap merge _otherHashMap;

Additional Information

See also:
insert set

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

[[Category:Introduced with arma3dev version 2.04]][[ Category: arma3dev: New Scripting Commands | MERGE]][[ Category: arma3dev: Scripting Commands | MERGE]]