HH\ImmVector::mapWithKey

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

Description

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

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

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

Parameters

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

Return Values

Examples

See Vector::mapWithKey for usage examples.