hphp/hack/manual/apis/Interfaces/ConstVector/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 read-only (immutable) sequence of values, indexed by integers (i.e., a vector)
interface ConstVector implements ConstCollection<Tv>, ConstIndexAccess<int, Tv>, HH\KeyedIterable<int, Tv>, HH\KeyedContainer<int, Tv> {...}
->concat<Tu super Tv>(Traversable<Tu> $traversable): ConstVector<Tu>ConstVector that is the concatenation of the values of the
current ConstVector and the values of the provided Traversable->filter((function(Tv): bool) $fn): ConstVector<Tv>ConstVector containing the values of the current ConstVector
that meet a supplied condition->filterWithKey((function(int, Tv): bool) $fn): ConstVector<Tv>ConstVector containing the values of the current ConstVector
that meet a supplied condition applied to its keys and values->firstKey(): ?intConstVector->firstValue(): ?TvConstVector->keys(): ConstVector<int>ConstVector containing the keys of the current ConstVector->lastKey(): ?intConstVector->lastValue(): ?TvConstVector->linearSearch(mixed $search_value): int->map<Tu>((function(Tv): Tu) $fn): ConstVector<Tu>ConstVector containing the values after an operation has been
applied to each value in the current ConstVector->mapWithKey<Tu>((function(int, Tv): Tu) $fn): ConstVector<Tu>ConstVector containing the values after an operation has been
applied to each key and value in the current ConstVector->skip(int $n): ConstVector<Tv>ConstVector containing the values after the n-th element of
the current ConstVector->skipWhile((function(Tv): bool) $fn): ConstVector<Tv>ConstVector containing the values of the current ConstVector
starting after and including the first value that produces true when
passed to the specified callback->slice(int $start, int $len): ConstVector<Tv>ConstVector starting from a given key up
to, but not including, the element at the provided length from the starting
key->take(int $n): ConstVector<Tv>ConstVector containing the first n values of the current
ConstVector->takeWhile((function(Tv): bool) $fn): ConstVector<Tv>ConstVector containing the values of the current ConstVector
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(): ConstVector<Tv>ConstVector containing the values of the current
ConstVector->zip<Tu>(Traversable<Tu> $traversable): ConstVector<Pair<Tv, Tu>>ConstVector where each element is a Pair that combines the
element of the current ConstVector 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 Iterable