For every element in the provided Traversable, add a key/value pair into the current Map

public function addAll(
  ?Traversable<Pair<Tk, Tv>> $iterable,
): Map<Tk, Tv>;

This method is equivalent to Map::setAll(). If a key in the Traversable exists in the Map, then the value associated with that key in the Map is overwritten.

Future changes made to the current Map ARE reflected in the returned Map, and vice-versa.




The following example adds a collection of key-value pairs to the Map $m and also adds multiple collections of key-value pairs to $m through chaining. Since Map::addAll() returns a shallow copy of $m itself, you can chain a bunch of addAll() calls together.

$m = Map {};

// Add all the key-value pairs in an array
$m->addAll(varray[Pair {'red', '#ff0000'}]);

// Map::addAll returns the Map so it can be chained
$m->addAll(Vector {
  Pair {'green', '#00ff00'},
  Pair {'blue', '#0000ff'},
  ->addAll(ImmVector {
    Pair {'yellow', '#ffff00'},
    Pair {'purple', '#663399'},