HH\ImmSet
ImmSet is an immutable, ordered set-style collection
HHVM provides a native implementation for this class. The PHP class definition below is not actually used at run time; it is simply provided for the typechecker and for developer reference.
An ImmSet cannot be mutated. No elements can be added or removed from it,
nor can elements be overwritten using assignment (i.e. $s[$k] = $v is
not allowed).
Construct it with a Traversable:
$a = vec[1, 2];
$s = new ImmSet($a);
or use the literal syntax:
$s = ImmSet {1, 2};
Guides
Interface Synopsis
namespace HH;
final class ImmSet implements \ConstSet<Tv> {...}
Public Methods
- ::fromArrays(...$argv): ImmSet<Tv>
 Returns an- ImmSetcontaining all the values from the specified- array(s)
- ::fromItems(?Traversable<Tv> $iterable): ImmSet<Tv>
 Creates an- ImmSetfrom the given- Traversable, or an empty- ImmSetif- nullis passed
- ::fromKeysOf<Tk as arraykey>(?KeyedContainer<Tk, mixed> $container): ImmSet<Tk>
 Creates an- ImmSetfrom the keys of the specified container
- ->__construct(?Traversable<Tv> $iterable = NULL): void
 Creates an- ImmSetfrom the given- Traversable, or an empty- ImmSetif- nullis passed
- ->__toString(): string
 Returns the- stringversion of this- ImmSet, which is- "ImmSet"
- ->concat<Tu super Tv>(Traversable<Tu> $traversable): ImmVector<Tu>
 Returns an- ImmVectorthat is the concatenation of the values of the current- ImmSetand the values of the provided- Traversable
- ->contains(arraykey $val): bool
 Determines if the specified value is in the current- ImmSet
- ->count(): int
 Provides the number of elements in the current- ImmSet
- ->filter((function(Tv): bool) $callback): ImmSet<Tv>
 Returns an- ImmSetcontaining the values of the current- ImmSetthat meet a supplied condition applied to each value
- ->filterWithKey((function(arraykey, Tv): bool) $callback): ImmSet<Tv>
 Returns an- ImmSetcontaining the values of the current- ImmSetthat meet a supplied condition applied to its "keys" and values
- ->firstKey(): ?arraykey
 Returns the first "key" in the current- ImmSet
- ->firstValue(): ?Tv
 Returns the first value in the current- ImmSet
- ->getIterator(): KeyedIterator<arraykey, Tv>
 Returns an iterator that points to beginning of the current- ImmSet
- ->immutable(): ImmSet<Tv>
 Returns an immutable copy (- ImmSet) of the current- ImmSet
- ->isEmpty(): bool
 Checks if the current- ImmSetis empty
- ->items(): Iterable<Tv>
 Returns an Iterable view of the current- ImmSet
- ->keys(): ImmVector<arraykey>
 Returns an- ImmVectorcontaining the values of this- ImmSet
- ->lastKey(): ?arraykey
 Returns the last "key" in the current- ImmSet
- ->lastValue(): ?Tv
 Returns the last value in the current- ImmSet
- ->lazy(): KeyedIterable<arraykey, Tv>
 Returns a lazy, access elements only when needed view of the current- ImmSet
- ->map<Tu as arraykey>((function(Tv): Tu) $callback): ImmSet<Tu>
 Returns an- ImmSetcontaining the values after an operation has been applied to each value in the current- ImmSet
- ->mapWithKey<Tu as arraykey>((function(arraykey, Tv): Tu) $callback): ImmSet<Tu>
 Returns an- ImmSetcontaining the values after an operation has been applied to each "key" and value in the current- ImmSet
- ->skip(int $n): ImmSet<Tv>
 Returns an- ImmSetcontaining the values after the- n-th element of the current- ImmSet
- ->skipWhile((function(Tv): bool) $fn): ImmSet<Tv>
 Returns an- ImmSetcontaining the values of the current- ImmSetstarting after and including the first value that produces- truewhen passed to the specified callback
- ->slice(int $start, int $len): ImmSet<Tv>
 Returns a subset of the current- ImmSetstarting from a given key up to, but not including, the element at the provided length from the starting key
- ->take(int $n): ImmSet<Tv>
 Returns an- ImmSetcontaining the first n values of the current- ImmSet
- ->takeWhile((function(Tv): bool) $callback): ImmSet<Tv>
 Returns an- ImmSetcontaining the values of the current- ImmSetup to but not including the first value that produces- falsewhen passed to the specified callback
- ->toDArray(): darray<Tv, Tv>
 Returns a darray built from the values from this ImmSet, darray[val1 => val1, val2 => val2, ...]
- ->toImmMap(): ImmMap<arraykey, Tv>
 Returns an immutable map (- ImmMap) based on the values of the current- ImmSet
- ->toImmSet(): ImmSet<Tv>
 Returns an immutable copy (- ImmSet) of the current- ImmSet
- ->toImmVector(): ImmVector<Tv>
 Returns an immutable vector (- ImmVector) with the values of the current- ImmSet
- ->toKeysArray(): varray<Tv>
 Returns an- arraycontaining the values from the current- ImmSet
- ->toMap(): object
 Returns a Map built from the keys and values of this ImmSet
- ->toSet(): object
 Returns a Set built from the values of this ImmSet
- ->toVArray(): varray<Tv>
- ->toValuesArray(): varray<Tv>
 Returns an- arraycontaining the values from the current- ImmSet
- ->toVector(): object
 Returns a Vector built from the values of this ImmSet
- ->values(): ImmVector<Tv>
 Returns an- ImmVectorcontaining the values of the current- ImmSet
- ->zip<Tu>(Traversable<Tu> $traversable): ImmSet<nothing>
 Throws an exception unless the current- ImmSetor the- Traversableis empty