MCPcopy Index your code
hub / github.com/TheAlgorithms/Go / getNodeByKey

Method getNodeByKey

structure/hashmap/hashmap.go:80–90  ·  view source on GitHub ↗

getNodeByKey finds the node associated with the given key

(key any)

Source from the content-addressed store, hash-verified

78
79// getNodeByKey finds the node associated with the given key
80func (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
93func (hm *HashMap) resize() {

Callers 2

GetMethod · 0.95
ContainsMethod · 0.95

Calls 1

hashMethod · 0.95

Tested by

no test coverage detected