A hash map stores key-value pairs and allows efficient lookup of keys by using a hash function.
datastructures currently provides a reference implementation of hashmaps using a hashtable stored in a plain GAP list.
‣ IsHashMap ( arg ) | ( filter ) |
Returns: true
or false
Category of hash maps
‣ HashMap ( [values][,] [hashfunc[, eqfunc]][,] [capacity] ) | ( function ) |
Create a new hash map. The optional argument values must be a list of key-value pairs which will be inserted into the new hashmap in order. The optional argument hashfunc must be a hash-function, eqfunc must be a binary equality testing function that returns true
if the two arguments are considered equal, and false
if they are not. Refer to Chapter 6 about the requirements for hashfunctions and equality testers. The optional argument capacity determines the initial size of the hashmap.
‣ Keys ( h ) | ( operation ) |
Returns: a list
Returns the list of keys of the hashmap h.
‣ Values ( h ) | ( operation ) |
Returns: a list
Returns the set of values stored in the hashmap h.
‣ KeyIterator ( h ) | ( operation ) |
Returns: an iterator
Returns an iterator for the keys stored in the hashmap h.
‣ ValueIterator ( h ) | ( operation ) |
Returns: an iterator
Returns an iterator for the values stored in the hashmap h.
‣ KeyValueIterator ( h ) | ( operation ) |
Returns: an iterator
Returns an iterator for key-value-pairs stored in the hashmap h.
7.1-8 \[\]
‣ \[\] ( hashmap, object ) | ( operation ) |
List-style access for hashmaps.
7.1-9 \[\]\:\=
‣ \[\]\:\= ( hashmap, object, object ) | ( operation ) |
List-style assignment for hashmaps.
7.1-10 \in
‣ \in ( object, hashmap ) | ( operation ) |
Test whether a key is stored in the hashmap.
7.1-11 IsBound\[\]
‣ IsBound\[\] ( object, hashmap ) | ( operation ) |
Test whether a key is stored in the hashmap.
7.1-12 Unbind\[\]
‣ Unbind\[\] ( object, hashmap ) | ( operation ) |
Delete a key from a hashmap.
‣ Size ( hashmap ) | ( operation ) |
Determine the number of keys stored in a hashmap.
‣ IsEmpty ( object, hashmap ) | ( operation ) |
Test whether a hashmap is empty.
generated by GAPDoc2HTML