HH\Map::concat

Returns a Vector that is the concatenation of the values of the current Map and the values of the provided Traversable

public function concat<Tu super Tv>(
  Traversable<Tu> $traversable,
): Vector<Tu>;

The provided Traversable is concatenated to the end of the current Map to produce the returned Vector.

Guide

Parameters

Returns

Examples

This example creates new Vectors by concatenating the values in a Map with Traversables:

$m = Map {
  'red' => '#ff0000',
};

// Create a Vector by concating the values from $m with a Set
$v1 = $m->concat(Set {'#00ff00', '#0000ff'});

// Create a Vector by concating the values from $m with a Vector
$v2 = $m->concat(Vector {'#ffff00', '#663399'});

var_dump($m->values()); // $m contains the value '#ff0000'
var_dump($v1); // $v1 contains '#ff0000', '#00ff00', '#0000ff'
var_dump($v2); // $v2 contains '#ff0000', '#ffff00', '#663399'
Output
object(HH\Vector)#6 (1) {
  [0]=>
  string(7) "#ff0000"
}
object(HH\Vector)#3 (3) {
  [0]=>
  string(7) "#ff0000"
  [1]=>
  string(7) "#00ff00"
  [2]=>
  string(7) "#0000ff"
}
object(HH\Vector)#5 (3) {
  [0]=>
  string(7) "#ff0000"
  [1]=>
  string(7) "#ffff00"
  [2]=>
  string(7) "#663399"
}