* Add the given string to this set. * * @param String aStr
(aStr, aAllowDuplicates)
| 44 | * @param String aStr |
| 45 | */ |
| 46 | add(aStr, aAllowDuplicates) { |
| 47 | const isDuplicate = this.has(aStr); |
| 48 | const idx = this._array.length; |
| 49 | if (!isDuplicate || aAllowDuplicates) { |
| 50 | this._array.push(aStr); |
| 51 | } |
| 52 | if (!isDuplicate) { |
| 53 | this._set.set(aStr, idx); |
| 54 | } |
| 55 | } |
| 56 | |
| 57 | /** |
| 58 | * Is the given string a member of this set? |
no test coverage detected