* @returns a new Set containing all the elements which are in either this Set or in the argument, but not in both.
(other: ReadonlySet<T>)
| 203 | * @returns a new Set containing all the elements which are in either this Set or in the argument, but not in both. |
| 204 | */ |
| 205 | public symmetricDifference(other: ReadonlySet<T>): Set<T> { |
| 206 | const result = new Set<T>(this); |
| 207 | for (const item of other) { |
| 208 | if (this.has(item)) { |
| 209 | result.delete(item); |
| 210 | } else { |
| 211 | result.add(item); |
| 212 | } |
| 213 | } |
| 214 | return result; |
| 215 | } |
| 216 | |
| 217 | /** |
| 218 | * @returns a boolean indicating whether all the elements in this Set are also in the argument. |