()
| 19 | } |
| 20 | |
| 21 | removeLastUsed() { |
| 22 | const [key, next, prev] = [ |
| 23 | this.head.next.key, |
| 24 | this.head.next.next, |
| 25 | this.head, |
| 26 | ]; |
| 27 | |
| 28 | this.map.delete(key); |
| 29 | this.head.next = next; |
| 30 | this.head.next.prev = prev; |
| 31 | } |
| 32 | |
| 33 | put(key, value) { |
| 34 | const hasKey = this.get(key) !== -1; |