HH\ImmVector::map

Returns an ImmVector containing the values after an operation has been applied to each value in the current ImmVector.

Description

public function map(
  (function(Tv):Tu) $callback,
): ImmVector<Tu>

Returns an ImmVector containing the values after an operation has been applied to each value in the current ImmVector.

Every value in the current ImmVector is affected by a call to map(), unlike filter() where only values that meet a certain criteria are affected.

Parameters

  • (function(Tv):Tu) $callback - The callback containing the operation to apply to the current ImmVector values.

Return Values

Examples

See Vector::map for usage examples.