(key)
| 56 | } |
| 57 | |
| 58 | get(key) { |
| 59 | const hasKey = this.map.has(key); |
| 60 | if (!hasKey) return -1; |
| 61 | |
| 62 | const node = this.map.get(key); |
| 63 | |
| 64 | this.disconnectNode(node); |
| 65 | this.moveToFront(node); |
| 66 | |
| 67 | return node.value; |
| 68 | } |
| 69 | |
| 70 | disconnectNode(node) { |
| 71 | node.next.prev = node.prev; |
no test coverage detected