Goto Chapter: Top 1 2 3 4 5 6 7 8 9 10 11 Bib Ind
 [Top of Book]  [Contents]   [Previous Chapter]   [Next Chapter] 

7 Hashmaps
 7.1 API

7 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.

7.1 API

7.1-1 IsHashMap
‣ IsHashMap( arg )( filter )

Returns: true or false

Category of hash maps

7.1-2 HashMap
‣ HashMap( [hashfunc[, eqfunc, ]][capacity] )( function )

Create a new hash map. 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.

7.1-3 Keys
‣ Keys( h )( operation )

Returns: a list

Returns the list of keys of the hashmap h.

7.1-4 Values
‣ Values( h )( operation )

Returns: a list

Returns the set of values stored in the hashmap h.

7.1-5 KeyIterator
‣ KeyIterator( h )( operation )

Returns: an iterator

Returns an interator for the keys stored in the hashmap h.

7.1-6 ValueIterator
‣ ValueIterator( h )( operation )

Returns: an iterator

Returns an interator for the values stored in the hashmap h.

7.1-7 KeyValueIterator
‣ KeyValueIterator( h )( operation )

Returns: an iterator

Returns an interator for key-value-pairs stored in the hashmap h.

7.1-8 \[\]
‣ \[\]( hashmap, object )( function )

List-style access for hashmaps.

7.1-9 \[\]\:\=
‣ \[\]\:\=( hashmap, object )( function )

List-style access for hashmaps.

7.1-10 \in
‣ \in( object, hashmap )( function )

Test whether a key is stored in the hashmap.

7.1-11 IsBound\[\]
‣ IsBound\[\]( object, hashmap )( function )

Test whether a key is stored in the hashmap.

7.1-12 Unbind\[\]
‣ Unbind\[\]( object, hashmap )( function )

Delete a key from a hashmap.

7.1-13 Size
‣ Size( hashmap )( function )

Determine the number of keys stored in a hashmap.

7.1-14 IsEmpty
‣ IsEmpty( object, hashmap )( function )

Test whether a hashmap is empty.

 [Top of Book]  [Contents]   [Previous Chapter]   [Next Chapter] 
Goto Chapter: Top 1 2 3 4 5 6 7 8 9 10 11 Bib Ind

generated by GAPDoc2HTML