HH\ImmMap

The HH\ImmMap<Tk,Tv> class

This page is a quick reference for people already familiar with the class. If this is new to you, we strongly recommend reading the introductory guides first:


ImmMap is an immutable Map. 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.

A ImmMap cannot be mutated. No elements can be added or removed from it, nor can elements be overwritten using assignment (i.e. $c[$k] = $v is not allowed).

Construct it with a Traversable:

$a = array('a' => 1, 'b' => 2);
$fm = new ImmMap($a);

or use the literal syntax

$fm = ImmMap {'a' => 1, 'b' => 2};

Interface synopsis

class ImmMap implements ConstMap, Indexish {...}