Hashmaps

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.

API

true or false Category of hash maps 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 about the requirements for hashfunctions and equality testers. The optional argument capacity determines the initial size of the hashmap.

a list Returns the list of keys of the hashmap h. a list Returns the set of values stored in the hashmap h. an iterator Returns an iterator for the keys stored in the hashmap h. an iterator Returns an iterator for the values stored in the hashmap h. an iterator Returns an iterator for key-value-pairs stored in the hashmap h. List-style access for hashmaps. List-style assignment for hashmaps. Test whether a key is stored in the hashmap. Test whether a key is stored in the hashmap. Delete a key from a hashmap. Determine the number of keys stored in a hashmap. Test whether a hashmap is empty.