hphp/hack/manual/apis/Interfaces/MutableVector/index.md
:::info[Note] This is a point-in-time snapshot of the API documentation from January 2026. Going forward, we will not be maintaining a public copy of these references, and recommend users to refer to the built-in signature helpers available in the Hack LSP instead for complete and up-to-date information. :::
Represents a write-enabled (mutable) sequence of values, indexed by integers (i.e., a vector)
interface MutableVector implements ConstVector<Tv>, HH\Collection<Tv>, IndexAccess<int, Tv> {...}
->concat<Tu super Tv>(Traversable<Tu> $traversable): MutableVector<Tu>MutableVector that is the concatenation of the values of the
current MutableVector and the values of the provided Traversable->filter((function(Tv): bool) $fn): MutableVector<Tv>MutableVector containing the values of the current
MutableVector that meet a supplied condition->filterWithKey((function(int, Tv): bool) $fn): MutableVector<Tv>MutableVector containing the values of the current
MutableVector that meet a supplied condition applied to its keys and
values->firstKey(): ?intMutableVector->firstValue(): ?TvMutableVector->keys(): MutableVector<int>MutableVector containing the keys of the current
MutableVector->lastKey(): ?intMutableVector->lastValue(): ?TvMutableVector->linearSearch(mixed $search_value): int->map<Tu>((function(Tv): Tu) $fn): MutableVector<Tu>MutableVector containing the values after an operation has been
applied to each value in the current MutableVector->mapWithKey<Tu>((function(int, Tv): Tu) $fn): MutableVector<Tu>MutableVector containing the values after an operation has been
applied to each key and value in the current MutableVector->skip(int $n): MutableVector<Tv>MutableVector containing the values after the n-th element of
the current MutableVector->skipWhile((function(Tv): bool) $fn): MutableVector<Tv>MutableVector containing the values of the current
MutableVector starting after and including the first value that produces
true when passed to the specified callback->slice(int $start, int $len): MutableVector<Tv>MutableVector 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>MutableVector containing the first n values of the current
MutableVector->takeWhile((function(Tv): bool) $fn): MutableVector<Tv>MutableVector containing the values of the current
MutableVector up to but not including the first value that produces
false when passed to the specified callback->toDArray(): darray<int, Tv>->toVArray(): varray<Tv>->values(): MutableVector<Tv>MutableVector containing the values of the current
MutableVector->zip<Tu>(Traversable<Tu> $traversable): MutableVector<Pair<Tv, Tu>>MutableVector where each element is a Pair that combines the
element of the current MutableVector and the provided TraversableConstCollection)->count(): int
Get the number of items in the collection
->isEmpty(): bool
Is the collection empty?
->items(): HH\Iterable<Te>
Get access to the items in the collection
IPureStringishObject)ConstIndexAccess)->at(Tk $k): Tv->containsKey(mixed $k): bool->get(Tk $k): ?TvHH\KeyedIterable)->getIterator(): KeyedIterator<Tk, Tv>KeyedIterable->lazy(): KeyedIterable<Tk, Tv>KeyedIterable->toImmMap(): ImmMap<Tk, Tv>ImmMap) based on the keys and values of the
current KeyedIterable->toKeysArray(): varrayarray with the keys from the current KeyedIterableHH\Iterable)->toImmSet(): ImmSet<Tv>ImmSet) converted from the current Iterable->toImmVector(): ImmVector<Tv>ImmVector) converted from the current
Iterable->toValuesArray(): varray<Tv>array with the values from the current IterableHH\Collection)->clear()OutputCollection)->add(Te $e): this->addAll(?Traversable<Te> $traversable): thisTraversable, append a value into the
current collectionIndexAccess)->removeKey(Tk $k): this->set(Tk $k, Tv $v): this->setAll(?KeyedTraversable<Tk, Tv> $traversable): thisTraversable, stores a value into the
current collection associated with each key, overwriting the previous value
associated with the key