(int capacity)
| 18 | public DoublyLinkedListNode head; |
| 19 | public DoublyLinkedListNode tail; |
| 20 | public LRUCache(int capacity) { |
| 21 | this.capacity = capacity; |
| 22 | // A hash map that maps keys to nodes. |
| 23 | cache = new HashMap<>(); |
| 24 | // Initialize the head and tail dummy nodes and connect them to |
| 25 | // each other to establish a basic two-node doubly linked list. |
| 26 | head = new DoublyLinkedListNode(-1, -1); |
| 27 | tail = new DoublyLinkedListNode(-1, -1); |
| 28 | head.next = tail; |
| 29 | tail.prev = head; |
| 30 | } |
| 31 | |
| 32 | public int get(int key) { |
| 33 | if (!cache.containsKey(key)) { |
nothing calls this directly
no outgoing calls
no test coverage detected