interface Map<K, T>
package polygonal.ds
extends Collection › Hashable
implemented by HashTable, IntHashTable, IntIntHashTable
An object that maps keys to values
This map allows duplicate keys.
Methods
get (key:K):T
Returns the element that is mapped to key
or a special value (see implementation) indicating that key
does not exist.
remap (key:K, val:T):Bool
set (key:K, val:T):Bool
Maps val
to key
.
Multiple keys are stored in a First-In-First-Out (FIFO) order - there is no way to access keys which were added after the first key
,
other than removing the first key
which unveils the second key
.
Returns:
true if key
was added for the first time, false if this key
is not unique.
unset (key:K):Bool
Removes a {key
,value} pair.
Returns:
true if key
was successfully removed, false if key
does not exist.