* @returns a new Set containing all the elements which are both in this Set and in the argument.
(other: ReadonlySet<T>)
| 179 | * @returns a new Set containing all the elements which are both in this Set and in the argument. |
| 180 | */ |
| 181 | public intersection(other: ReadonlySet<T>) { |
| 182 | const result = new Set<T>(); |
| 183 | for (const item of this) { |
| 184 | if (other.has(item)) { |
| 185 | result.add(item); |
| 186 | } |
| 187 | } |
| 188 | return result; |
| 189 | } |
| 190 | |
| 191 | /** |
| 192 | * @returns a new Set containing all the elements in this Set which are not also in the argument. |