HH\Pair::concat

Returns an ImmVector that is the concatenation of the values of the current Pair and the values of the provided Traversable.

Description

public function concat(
  Traversable<Tu> $traversable,
): ImmVector<Tu>

Returns an ImmVector that is the concatenation of the values of the current Pair and the values of the provided Traversable.

The values of the provided Traversable is concatenated to the end of the current Pair to produce the returned ImmVector.

Parameters

  • Traversable<Tu> $traversable - The Traversable to concatenate to the current Pair.

Return Values

Examples

This example creates a new ImmVector by concatenating a Traversable with the values in the Pair.

<?hh

namespace Hack\UserDocumentation\API\Examples\Pair\Concat;

$p = Pair {'foo', -1.5};

$v = $p->concat(array(100, 'bar'));
var_dump($v);
Output
object(HH\ImmVector)#2 (4) {
  [0]=>
  string(3) "foo"
  [1]=>
  float(-1.5)
  [2]=>
  int(100)
  [3]=>
  string(3) "bar"
}