* Adds a value to the set. * @param value - The value to add * @returns true if added, false if already present * @complexity Time O(1) | Space O(1)
(value: string)
| 9 | * @complexity Time O(1) | Space O(1) |
| 10 | */ |
| 11 | add(value: string): boolean { |
| 12 | if (!this.has(value)) { |
| 13 | this.#items[value] = true; |
| 14 | this.#size++; |
| 15 | return true; |
| 16 | } |
| 17 | return false; |
| 18 | } |
| 19 | |
| 20 | /** |
| 21 | * Adds multiple values to the set. |
no test coverage detected