HH\ImmVector::immutable

Returns the current ImmVector

public function immutable(): ImmVector<Tv>;

Unlike Vector's toVector() method, this does not actually return a copy of the current ImmVector. Since ImmVectors are immutable, there is no reason to pay the cost of creating a copy of the current ImmVector.

This method is interchangeable with toImmVector().

This method is NOT interchangeable with values(). values() returns a new ImmVector that is a copy of the current ImmVector, and thus incurs both the cost of copying the current ImmVector, and the memory space consumed by the new ImmVector. This may be significant, for large ImmVectors.

Returns

Examples

See [Vector::immutable](</hack/reference/class/Vector/immutable/#examples>) for usage examples.