MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / get

Method get

Java/Leetcode/LeetcodeLruCache.java:13–22  ·  view source on GitHub ↗
(int key)

Source from the content-addressed store, hash-verified

11 }
12
13 public int get(int key) {
14 if(cache.containsKey(key)){
15 Node curNode = cache.get(key);
16 remove(curNode);
17 insert(curNode);
18 return curNode.value;
19 }else{
20 return -1;
21 }
22 }
23
24 public void put(int key, int value) {
25 if(cache.containsKey(key)){

Callers 8

isValidMethod · 0.45
BFSMethod · 0.45
copyRandomListMethod · 0.45
nextMethod · 0.45
bestHandMethod · 0.45
countMatchesMethod · 0.45
putMethod · 0.45
countStringsMethod · 0.45

Calls 2

removeMethod · 0.95
insertMethod · 0.95

Tested by

no test coverage detected