hphp/hack/manual/apis/Interfaces/MutableMap/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 key/value pairs (i.e. a map)
interface MutableMap implements ConstMap<Tk, Tv>, HH\Collection<Pair<Tk, Tv>>, MapAccess<Tk, Tv> {...}
->concat<Tu super Tv>(Traversable<Tu> $traversable): MutableVector<Tu>MutableVector that is the concatenation of the values of the
current MutableMap and the values of the provided Traversable->filter((function(Tv): bool) $fn): MutableMap<Tk, Tv>MutableMap containing the values of the current MutableMap
that meet a supplied condition->filterWithKey((function(Tk, Tv): bool) $fn): MutableMap<Tk, Tv>MutableMap containing the values of the current MutableMap
that meet a supplied condition applied to its keys and values->firstKey(): ?TkMutableMap->firstValue(): ?TvMutableMap->keys(): MutableVector<Tk>MutableVector containing the keys of the current MutableMap->lastKey(): ?TkMutableMap->lastValue(): ?TvMutableMap->map<Tu>((function(Tv): Tu) $fn): MutableMap<Tk, Tu>MutableMap after an operation has been applied to each value
in the current MutableMap->mapWithKey<Tu>((function(Tk, Tv): Tu) $fn): MutableMap<Tk, Tu>MutableMap after an operation has been applied to each key and
value in the current MutableMap->skip(int $n): MutableMap<Tk, Tv>MutableMap containing the values after the n-th element of
the current MutableMap->skipWhile((function(Tv): bool) $fn): MutableMap<Tk, Tv>MutableMap containing the values of the current MutableMap
starting after and including the first value that produces true when
passed to the specified callback->slice(int $start, int $len): MutableMap<Tk, Tv>MutableMap 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): MutableMap<Tk, Tv>MutableMap containing the first n key/values of the current
MutableMap->takeWhile((function(Tv): bool) $fn): MutableMap<Tk, Tv>MutableMap containing the keys and values of the current
MutableMap 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(): MutableVector<Tv>MutableVector containing the values of the current
MutableMap->zip<Tu>(Traversable<Tu> $traversable): MutableMap<Tk, Pair<Tv, Tu>>MutableMap where each value is a Pair that combines the
value of the current MutableMap 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 IterableHH\Collection)->clear()OutputCollection)->add(Te $e): this->addAll(?Traversable<Te> $traversable): thisTraversable, append a value into the
current collectionSetAccess)->remove(Tm $m): thisSetIndexAccess)->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