Repository navigation
Hash
A hash is a dynamically-resizable container that uses arbitrary keys. The key ':k' can be any object with the 'hash' method defined. Hashes provide efficient lookup and deletion (amortized constant) assuming a good hash function. Worst case lookup is linear with respect to the number of objects in the hash.
@init()
Creates a new hash with zero elements.
@destroy()
Releases memory used by the hash, and decrements all the reference counts on objects held by the hash
Inserts 'value' into the hash map with key 'key'. The key can be used to retrieve the value later.
Returns the element associated with 'key'. Returns nil if there is no element associated with 'key'.
Returns a new hash that is the union over the keys in this hash and 'other'. If there is a key present in both hashes, the associated value in this hash takes takes precedence over the associated value in 'other'.
Returns an iterator for all the key-value pairs in this hash.
values?() HashValueIter[:k,:v]
Returns an iterator for all the values in this hash.
keys?() HashKeyIter[:k,:v]
Returns an iterator for all the keys in this hash.
Returns the hash for 'element'
Compares 'first' and second' for equality
rehash()
Re-sizes the hash, and re-hashes all buckets.
No comment
No comment