HH\ImmVector::toImmVector

Returns the current ImmVector.

Description

public function toImmVector(): ImmVector<Tv>

Returns the current ImmVector.

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 immutable().

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.

Return Values

Examples

See Vector::toImmVector for usage examples.