Returns the current ImmVector

public function toImmVector(): 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 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.


  • ImmVector<Tv> - The current ImmVector.


See Vector::toImmVector for usage examples.