getNodeByKey finds the node associated with the given key
(key any)
| 78 | |
| 79 | // getNodeByKey finds the node associated with the given key |
| 80 | func (hm *HashMap) getNodeByKey(key any) *node { |
| 81 | index := hm.hash(key) |
| 82 | current := hm.table[index] |
| 83 | for current != nil { |
| 84 | if current.key == key { |
| 85 | return current |
| 86 | } |
| 87 | current = current.next |
| 88 | } |
| 89 | return nil |
| 90 | } |
| 91 | |
| 92 | // resize doubles the capacity of the hashmap and rehashes all existing entries |
| 93 | func (hm *HashMap) resize() { |