(key: K, value: V)
| 89 | } |
| 90 | |
| 91 | public set(key: K, value: V): this { |
| 92 | const isNewValue = !this.has(key); |
| 93 | if (isNewValue) { |
| 94 | this.size++; |
| 95 | } |
| 96 | this.items.set(key, value); |
| 97 | |
| 98 | // Do order bookkeeping |
| 99 | if (this.firstKey === undefined) { |
| 100 | this.firstKey = key; |
| 101 | this.lastKey = key; |
| 102 | } else if (isNewValue) { |
| 103 | this.nextKey.set(this.lastKey!, key); |
| 104 | this.previousKey.set(key, this.lastKey!); |
| 105 | this.lastKey = key; |
| 106 | } |
| 107 | |
| 108 | return this; |
| 109 | } |
| 110 | |
| 111 | public [Symbol.iterator](): IterableIterator<[K, V]> { |
| 112 | return this.entries(); |
no test coverage detected