1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-10-03 15:59:04 +00:00

Add missing MapTools function from #459

This commit is contained in:
EliteMasterEric 2024-04-04 03:35:36 -04:00
parent d8903f138f
commit 3ac466aa5e

View file

@ -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.
*/