Add a key/value pair to the end of the current Map

public function add(
  Pair<Tk, Tv> $val,
): Map<Tk, Tv>;

This method is equivalent to Map::set(). If the key in the Pair exists in the Map, the value associated with it is overwritten.

$map->add($p) is equivalent to both $map[$k] = $v and $map[] = Pair {$k, $v} (except that add() returns the Map).

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


Return Values