This class implements an association between keys and values. More...
#include <HashMap.h>
| Classes | |
| struct | Entry | 
| Type definition for each cells in the bucket chain.  More... | |
| class | iterator | 
| Iterator support for class HashMap.  More... | |
| Public Member Functions | |
| HashMap () | |
| virtual | ~HashMap () | 
| HashMap (const HashMap &src) | |
| This copy constructor is to make a deep copy of HashMap.  More... | |
| HashMap & | operator= (const HashMap &src) | 
| This operator= are defined assign from one map to another.  More... | |
| void | clear () | 
| Removes all entries from this map.  More... | |
| int | size () const | 
| bool | isEmpty () const | 
| void | put (const KeyType &key, const ValueType &value) | 
| Associates keywithvaluein this map.  More... | |
| ValueType | get (const KeyType &key) const | 
| bool | containsKey (const KeyType &key) const | 
| void | remove (const KeyType &key) | 
| removes any entry for keyfrom this map.  More... | |
| ValueType & | operator[] (const KeyType &key) | 
| Selects the value associated with key.  More... | |
| ValueType | operator[] (const KeyType &key) const | 
| iterator | begin () const | 
| iterator | end () const | 
| Private Member Functions | |
| void | createBuckets (int nBuckets) | 
| Creates vector of buckets to have nBuckets entries, each NULL.  More... | |
| void | deleteBuckets (std::vector< Entry * > &buckets) | 
| Deletes all the cells in the linked lists contained in vector.  More... | |
| void | expandAndRehash () | 
| Increases the buckets in the map and then rehashes all existing entries.  More... | |
| Entry * | findEntry (int bucket, const KeyType &key) const | 
| Finds a cell in the chain for the specified bucket that matches key.  More... | |
| Entry * | findEntry (int bucket, const KeyType &key, Entry *&parent) const | 
| void | deepCopy (const HashMap &src) | 
| Creates deep copy of src HashMap.  More... | |
| Private Attributes | |
| std::vector< Entry * > | buckets | 
| Vector of pointer to Entry.  More... | |
| int | nBuckets | 
| Total number of buckets.  More... | |
| int | numEntries | 
| Total number of entries.  More... | |
This class implements an association between keys and values.
It stores a set of key-value pairs and uses a hash table as its underlying representation.
| void HashMap< KeyType, ValueType >::clear | 
| bool HashMap< KeyType, ValueType >::containsKey | ( | const KeyType & | key | ) | const | 
| 
 | private | 
| 
 | private | 
| ValueType HashMap< KeyType, ValueType >::get | ( | const KeyType & | key | ) | const | 
| bool HashMap< KeyType, ValueType >::isEmpty | 
| ValueType & HashMap< KeyType, ValueType >::operator[] | ( | const KeyType & | key | ) | 
| ValueType HashMap< KeyType, ValueType >::operator[] | ( | const KeyType & | key | ) | const | 
| void HashMap< KeyType, ValueType >::put | ( | const KeyType & | key, | 
| const ValueType & | value | ||
| ) | 
| void HashMap< KeyType, ValueType >::remove | ( | const KeyType & | key | ) | 
| int HashMap< KeyType, ValueType >::size | 
| 
 | private |