MCPcopy Create free account
hub / github.com/algorithmzuo/algorithm-journey / get

Method get

src/class035/Code02_LRU.java:93–100  ·  view source on GitHub ↗
(int key)

Source from the content-addressed store, hash-verified

91 }
92
93 public int get(int key) {
94 if (keyNodeMap.containsKey(key)) {
95 DoubleNode ans = keyNodeMap.get(key);
96 nodeList.moveNodeToTail(ans);
97 return ans.val;
98 }
99 return -1;
100 }
101
102 public void put(int key, int value) {
103 if (keyNodeMap.containsKey(key)) {

Callers 15

mainMethod · 0.45
mainMethod · 0.45
maxValueOfCoins1Method · 0.45
maxValueOfCoins2Method · 0.45
fMethod · 0.45
bfsMethod · 0.45
dfsMethod · 0.45
minStickersMethod · 0.45
len1Method · 0.45
smallestRangeMethod · 0.45
finishMethod · 0.45
len2Method · 0.45

Calls 1

moveNodeToTailMethod · 0.80

Tested by

no test coverage detected