* Checks whether the exact tuple is already present in the set. * @param {[T, V, ...EXPECTED_ANY]} args tuple * @returns {boolean} true, if the tuple is in the Set
(...args)
| 71 | * @returns {boolean} true, if the tuple is in the Set |
| 72 | */ |
| 73 | has(...args) { |
| 74 | let map = this._map; |
| 75 | for (let i = 0; i < args.length - 2; i++) { |
| 76 | const arg = args[i]; |
| 77 | map = /** @type {InnerMap<T, V>} */ (map.get(arg)); |
| 78 | if (map === undefined) { |
| 79 | return false; |
| 80 | } |
| 81 | } |
| 82 | |
| 83 | const beforeLast = args[args.length - 2]; |
| 84 | const set = map.get(beforeLast); |
| 85 | if (set === undefined) { |
| 86 | return false; |
| 87 | } |
| 88 | |
| 89 | const last = args[args.length - 1]; |
| 90 | return set.has(last); |
| 91 | } |
| 92 | |
| 93 | /** |
| 94 | * Removes a tuple from the set when it is present. |