MCPcopy Index your code
hub / github.com/neetcode-gh/leetcode / get

Method get

java/0146-lru-cache.java:20–28  ·  view source on GitHub ↗
(int key)

Source from the content-addressed store, hash-verified

18 }
19
20 public int get(int key) {
21 if (cache.containsKey(key)) {
22 remove(cache.get(key));
23 insert(cache.get(key));
24 return cache.get(key).val;
25 } else {
26 return -1;
27 }
28 }
29
30 public void put(int key, int value) {
31 if (cache.containsKey(key)) {

Callers 1

putMethod · 0.45

Calls 2

removeMethod · 0.95
insertMethod · 0.95

Tested by

no test coverage detected