* Returns true if every element of otherSet is also in this set. * @param otherSet - The potential subset * @returns Whether this set is a superset of otherSet * @complexity Time O(n) | Space O(1)
(otherSet: MySet)
| 167 | * @complexity Time O(n) | Space O(1) |
| 168 | */ |
| 169 | isSupersetOf(otherSet: MySet): boolean { |
| 170 | if (this.size < otherSet.size) { |
| 171 | return false; |
| 172 | } |
| 173 | return otherSet.values().every(value => this.has(value)); |
| 174 | } |
| 175 | |
| 176 | /** |
| 177 | * Returns a comma-separated string of all set values. |
no test coverage detected