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