MCPcopy Create free account
hub / github.com/neetcode-gh/leetcode / get

Method get

java/0706-design-hashmap.java:26–32  ·  view source on GitHub ↗
(int key)

Source from the content-addressed store, hash-verified

24 data[h] = node;
25 }
26 public int get(int key) {
27 int h = hash(key);
28 ListNode node = data[h];
29 for (; node != null; node = node.next)
30 if (node.key == key) return node.val;
31 return -1;
32 }
33 public void remove(int key) {
34 int h = hash(key);
35 ListNode node = data[h];

Callers

nothing calls this directly

Calls 1

hashMethod · 0.95

Tested by

no test coverage detected