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