HashMap<K, V>

class HashMap<K: copyable, V: copyable>

A hash-based map from keys to values.

Remarks

HashMap owns shallow copies of its keys and values. Pointer and string keys copy the pointer value; the supplied hash policy controls identity or content comparison.

Lifecycle members

constructor

Initializes an empty map with a key hash policy and remembers the allocator used for storage.

destructor

Releases all allocated storage.

Instance members

void

Removes all entries and optionally releases storage.

bool

Returns true when the key is present.

nuint

Returns the number of key/value slots currently allocated.

V

Returns the value for a key, or default when the key is absent.

nuint
getLength()
property

Returns the number of entries in the map.

bool

Removes a key and returns true when an entry was removed.

void

Adds or replaces a value for a key.

bool

Gets a value and returns true when the key is present.

Generated with campc v0.4.0-preview.1+d50446ef951a6ed675f7086cf093dbc993f0041b.