MCPcopy Index your code
hub / github.com/careercup/ctci / moveToFront

Method moveToFront

java/Chapter 10/Question10_7/Cache.java:16–31  ·  view source on GitHub ↗
(Node node)

Source from the content-addressed store, hash-verified

14 }
15
16 public void moveToFront(Node node) {
17 if (node == head) {
18 return;
19 }
20 removeFromLinkedList(node);
21 node.next = head;
22 if (head != null) {
23 head.prev = node;
24 }
25 head = node;
26 size++;
27
28 if (tail == null) {
29 tail = node;
30 }
31 }
32
33 public void moveToFront(String query) {
34 Node node = map.get(query);

Callers 2

getResultsMethod · 0.95
insertResultsMethod · 0.95

Calls 2

removeFromLinkedListMethod · 0.95
getMethod · 0.45

Tested by

no test coverage detected