hphp/hack/manual/apis/Interfaces/MutableSet/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) set of values, not indexed by keys (i.e. a set)
interface MutableSet implements ConstSet<Tv>, HH\Collection<Tv>, SetAccess<Tv> {...}
->concat<Tu super Tv>(Traversable<Tu> $traversable): MutableVector<Tu>MutableVector that is the concatenation of the values of the
current MutableSet and the values of the provided Traversable->filter((function(Tv): bool) $fn): MutableSet<Tv>MutableSet containing the values of the current MutableSet
that meet a supplied condition applied to each value->filterWithKey((function(arraykey, Tv): bool) $fn): MutableSet<Tv>MutableSet containing the values of the current MutableSet
that meet a supplied condition applied to its "keys" and values->firstKey(): ?arraykeyMutableSet->firstValue(): ?TvMutableSet->keys(): MutableVector<arraykey>MutableVector containing the values of the current
MutableSet->lastKey(): ?arraykeyMutableSet->lastValue(): ?TvMutableSet->map<Tu as arraykey>((function(Tv): Tu) $fn): MutableSet<Tu>MutableSet containing the values after an operation has been
applied to each value in the current MutableSet->mapWithKey<Tu as arraykey>((function(arraykey, Tv): Tu) $fn): MutableSet<Tu>MutableSet containing the values after an operation has been
applied to each "key" and value in the current Set->skip(int $n): MutableSet<Tv>MutableSet containing the values after the n-th element of
the current MutableSet->skipWhile((function(Tv): bool) $fn): MutableSet<Tv>MutableSet containing the values of the current MutableSet
starting after and including the first value that produces true when
passed to the specified callback->slice(int $start, int $len): MutableSet<Tv>MutableSet starting from a given key up
to, but not including, the element at the provided length from the
starting key->take(int $n): MutableSet<Tv>MutableSet containing the first n values of the current
MutableSet->takeWhile((function(Tv): bool) $fn): MutableSet<Tv>MutableSet containing the values of the current MutableSet
up to but not including the first value that produces false when passed
to the specified callback->toDArray(): darray<Tv, Tv>->toVArray(): varray<Tv>->values(): MutableVector<Tv>MutableVector containing the values of the current
MutableSet->zip<Tu>(Traversable<Tu> $traversable): MutableSet<nothing>MutableSet where each value is a Pair that combines the
value of the current MutableSet 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): boolSetHH\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): thisSet