MutableVector
Represents a write-enabled (mutable) sequence of values, indexed by integers (i.e., a vector)
Guides
Interface Synopsis
interface MutableVector implements ConstVector<Tv>, HH\Collection<Tv>, IndexAccess<int, Tv> {...}
Public Methods
->concat<Tu super Tv>(Traversable<Tu> $traversable): MutableVector<Tu>
Returns aMutableVector
that is the concatenation of the values of the currentMutableVector
and the values of the providedTraversable
->filter((function(Tv): bool) $fn): MutableVector<Tv>
Returns aMutableVector
containing the values of the currentMutableVector
that meet a supplied condition->filterWithKey((function(int, Tv): bool) $fn): MutableVector<Tv>
Returns aMutableVector
containing the values of the currentMutableVector
that meet a supplied condition applied to its keys and values->firstKey(): ?int
Returns the first key in the currentMutableVector
->firstValue(): ?Tv
Returns the first value in the currentMutableVector
->keys(): MutableVector<int>
Returns aMutableVector
containing the keys of the currentMutableVector
->lastKey(): ?int
Returns the last key in the currentMutableVector
->lastValue(): ?Tv
Returns the last value in the currentMutableVector
->linearSearch(mixed $search_value): int
Returns the index of the first element that matches the search value->map<Tu>((function(Tv): Tu) $fn): MutableVector<Tu>
Returns aMutableVector
containing the values after an operation has been applied to each value in the currentMutableVector
->mapWithKey<Tu>((function(int, Tv): Tu) $fn): MutableVector<Tu>
Returns aMutableVector
containing the values after an operation has been applied to each key and value in the currentMutableVector
->skip(int $n): MutableVector<Tv>
Returns aMutableVector
containing the values after then
-th element of the currentMutableVector
->skipWhile((function(Tv): bool) $fn): MutableVector<Tv>
Returns aMutableVector
containing the values of the currentMutableVector
starting after and including the first value that producestrue
when passed to the specified callback->slice(int $start, int $len): MutableVector<Tv>
Returns a subset of the currentMutableVector
starting from a given key up to, but not including, the element at the provided length from the starting key->take(int $n): MutableVector<Tv>
Returns aMutableVector
containing the firstn
values of the currentMutableVector
->takeWhile((function(Tv): bool) $fn): MutableVector<Tv>
Returns aMutableVector
containing the values of the currentMutableVector
up to but not including the first value that producesfalse
when passed to the specified callback->toDArray(): darray<int, Tv>
->toVArray(): varray<Tv>
->values(): MutableVector<Tv>
Returns aMutableVector
containing the values of the currentMutableVector
->zip<Tu>(Traversable<Tu> $traversable): MutableVector<Pair<Tv, Tu>>
Returns aMutableVector
where each element is aPair
that combines the element of the currentMutableVector
and the providedTraversable