Skip to main content

ImmSet

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.

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