A map is a container style object that provides a mechanism for associating key objects with value objects. More...
Extended by: | |
Methods: |
|
Each key in a map occurs exactly once - a map cannot contain multiple equivalent keys.
Maps are very efficient, and can handle inserting, removing and finding keys in 'O(log2)' time. That is, the time needed to insert, remove or find a key is proportional to log2 of the number of items in the map.
Classes that extend map must implement the Compare method. This method is used by the map to compare keys, and must return -1 if the first key is less than the second, +1 if the first key is greater than the second, or 0 if the keys are equal.
The compare method must return a negative value if lhs < rhs, a positive value if lhs > rhs, or 0 if lhs = rhs.
The compare method is abstract so must be implemented by all subclasses of Map.
Returns the number of key/value pairs in the map.
Note that this method takes O(N) time, ie: it must visit each element of the map.
Returns the first node in the map. This is the node with the minimum key value.
Returns an object that can be used to iterate through all keys in a map with a For Eachin loop.
Returns the last node in the map. This is the node with the maximum key value.
Returns an object that can be used to enumerate all nodes in the map with a For EachIn loop.
See also Node
Set the value in a map associated with the given key.
Returns true if key was added to the map, or false if map already contained the given key.
The map is always updated - the return value only indicates whether an existing key/value association was updated (false) or a new one created (true).