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

Method put

java/0706-design-hashmap.java:20–25  ·  view source on GitHub ↗
(int key, int val)

Source from the content-addressed store, hash-verified

18 return (int)((long)key * mult % size);
19 }
20 public void put(int key, int val) {
21 remove(key);
22 int h = hash(key);
23 ListNode node = new ListNode(key, val, data[h]);
24 data[h] = node;
25 }
26 public int get(int key) {
27 int h = hash(key);
28 ListNode node = data[h];

Callers

nothing calls this directly

Calls 2

removeMethod · 0.95
hashMethod · 0.95

Tested by

no test coverage detected