mirror of
https://github.com/FunkinCrew/Funkin.git
synced 2024-11-23 08:07:54 -05:00
Add missing MapTools function from #459
This commit is contained in:
parent
d8903f138f
commit
3ac466aa5e
1 changed files with 18 additions and 0 deletions
|
@ -33,6 +33,24 @@ class MapTools
|
|||
return map.copy();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new map which is a combination of the two given maps.
|
||||
* @param a The base map.
|
||||
* @param b The other map. The values from this take precedence.
|
||||
* @return The combined map.
|
||||
*/
|
||||
public static function merge<K, T>(a:Map<K, T>, b:Map<K, T>):Map<K, T>
|
||||
{
|
||||
var result = a.copy();
|
||||
|
||||
for (pair in b.keyValueIterator())
|
||||
{
|
||||
result.set(pair.key, pair.value);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new array with clones of all elements of the given array, to prevent modifying the original.
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue