* Associates the provided key with the provided value. If the key already * exists, it is overwritten with the new value. * * @param {string|number} key A unique identifier. * @param {T} value The value to associate with the provided key.
(key, value)
| 66 | * @param {T} value The value to associate with the provided key. |
| 67 | */ |
| 68 | set(key, value) { |
| 69 | //>>includeStart('debug', pragmas.debug); |
| 70 | if (typeof key !== "string" && typeof key !== "number") { |
| 71 | throw new DeveloperError("key is required to be a string or number."); |
| 72 | } |
| 73 | //>>includeEnd('debug'); |
| 74 | |
| 75 | const oldValue = this._hash[key]; |
| 76 | if (value !== oldValue) { |
| 77 | this.remove(key); |
| 78 | this._hash[key] = value; |
| 79 | this._array.push(value); |
| 80 | } |
| 81 | } |
| 82 | |
| 83 | /** |
| 84 | * Retrieves the value associated with the provided key. |
no test coverage detected