(value: T)
| 32 | } |
| 33 | |
| 34 | public add(value: T): Set<T> { |
| 35 | const isNewValue = !this.has(value); |
| 36 | if (isNewValue) { |
| 37 | this.size++; |
| 38 | } |
| 39 | |
| 40 | // Do order bookkeeping |
| 41 | if (this.firstKey === undefined) { |
| 42 | this.firstKey = value; |
| 43 | this.lastKey = value; |
| 44 | } else if (isNewValue) { |
| 45 | this.nextKey.set(this.lastKey!, value); |
| 46 | this.previousKey.set(value, this.lastKey!); |
| 47 | this.lastKey = value; |
| 48 | } |
| 49 | |
| 50 | return this; |
| 51 | } |
| 52 | |
| 53 | public clear(): void { |
| 54 | this.nextKey = new LuaTable(); |
no test coverage detected