* Seeds the tuple set with an optional iterable of tuples. * @param {Iterable<[T, V, ...EXPECTED_ANY]>=} init init
(init)
| 25 | * @param {Iterable<[T, V, ...EXPECTED_ANY]>=} init init |
| 26 | */ |
| 27 | constructor(init) { |
| 28 | /** @type {InnerMap<T, V>} */ |
| 29 | this._map = new Map(); |
| 30 | /** @type {number} */ |
| 31 | this.size = 0; |
| 32 | if (init) { |
| 33 | for (const tuple of init) { |
| 34 | this.add(...tuple); |
| 35 | } |
| 36 | } |
| 37 | } |
| 38 | |
| 39 | /** |
| 40 | * Adds a tuple to the set, creating any missing prefix maps along the way. |