hphp/hack/manual/apis/Interfaces/ConstMap/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 key/value pairs, (i.e. a map)
interface ConstMap implements ConstCollection<Pair<Tk, Tv>>, ConstMapAccess<Tk, Tv>, HH\KeyedIterable<Tk, Tv>, HH\KeyedContainer<Tk, Tv> {...}
->concat<Tu super Tv>(Traversable<Tu> $traversable): ConstVector<Tu>ConstVector that is the concatenation of the values of the
current ConstMap and the values of the provided Traversable->filter((function(Tv): bool) $fn): ConstMap<Tk, Tv>ConstMap containing the values of the current ConstMap that
meet a supplied condition->filterWithKey((function(Tk, Tv): bool) $fn): ConstMap<Tk, Tv>ConstMap containing the values of the current ConstMap that
meet a supplied condition applied to its keys and values->firstKey(): ?TkConstMap->firstValue(): ?TvConstMap->keys(): ConstVector<Tk>ConstVector containing the keys of the current ConstMap->lastKey(): ?TkConstMap->lastValue(): ?TvConstMap->map<Tu>((function(Tv): Tu) $fn): ConstMap<Tk, Tu>ConstMap after an operation has been applied to each value in
the current ConstMap->mapWithKey<Tu>((function(Tk, Tv): Tu) $fn): ConstMap<Tk, Tu>ConstMap after an operation has been applied to each key and
value in the current ConstMap->skip(int $n): ConstMap<Tk, Tv>ConstMap containing the values after the n-th element of the
current ConstMap->skipWhile((function(Tv): bool) $fn): ConstMap<Tk, Tv>ConstMap containing the values of the current ConstMap
starting after and including the first value that produces true when
passed to the specified callback->slice(int $start, int $len): ConstMap<Tk, Tv>ConstMap starting from a given key
location up to, but not including, the element at the provided length from
the starting key location->take(int $n): ConstMap<Tk, Tv>ConstMap containing the first n key/values of the current
ConstMap->takeWhile((function(Tv): bool) $fn): ConstMap<Tk, Tv>ConstMap containing the keys and values of the current
ConstMap up to but not including the first value that produces false
when passed to the specified callback->toDArray(): darray<Tk, Tv>->toVArray(): varray<Tv>->values(): ConstVector<Tv>ConstVector containing the values of the current ConstMap->zip<Tu>(Traversable<Tu> $traversable): ConstMap<Tk, Pair<Tv, Tu>>ConstMap where each value is a Pair that combines the value
of the current ConstMap 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)ConstSetAccess)->contains(arraykey $m): boolSetConstIndexAccess)->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