1/* 2 * Copyright (c) 2021-2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16/** 17 * @file 18 * @kit ArkTS 19 */ 20 21/** 22 * HashSet is implemented based on HashMap. In HashSet, only the value object is processed. 23 * 24 * @syscap SystemCapability.Utils.Lang 25 * @since 8 26 */ 27/** 28 * HashSet is implemented based on HashMap. In HashSet, only the value object is processed. 29 * 30 * @syscap SystemCapability.Utils.Lang 31 * @crossplatform 32 * @since 10 33 */ 34/** 35 * HashSet is implemented based on HashMap. In HashSet, only the value object is processed. 36 * 37 * @syscap SystemCapability.Utils.Lang 38 * @crossplatform 39 * @atomicservice 40 * @since 12 41 */ 42declare class HashSet<T> { 43 /** 44 * A constructor used to create a HashSet object. 45 * 46 * @throws { BusinessError } 10200012 - The HashSet's constructor cannot be directly invoked. 47 * @syscap SystemCapability.Utils.Lang 48 * @since 8 49 */ 50 /** 51 * A constructor used to create a HashSet object. 52 * 53 * @throws { BusinessError } 10200012 - The HashSet's constructor cannot be directly invoked. 54 * @syscap SystemCapability.Utils.Lang 55 * @crossplatform 56 * @since 10 57 */ 58 /** 59 * A constructor used to create a HashSet object. 60 * 61 * @throws { BusinessError } 10200012 - The HashSet's constructor cannot be directly invoked. 62 * @syscap SystemCapability.Utils.Lang 63 * @crossplatform 64 * @atomicservice 65 * @since 12 66 */ 67 constructor(); 68 /** 69 * Gets the element number of the hashset. 70 * 71 * @syscap SystemCapability.Utils.Lang 72 * @since 8 73 */ 74 /** 75 * Gets the element number of the hashset. 76 * 77 * @syscap SystemCapability.Utils.Lang 78 * @crossplatform 79 * @since 10 80 */ 81 /** 82 * Gets the element number of the hashset. 83 * 84 * @syscap SystemCapability.Utils.Lang 85 * @crossplatform 86 * @atomicservice 87 * @since 12 88 */ 89 length: number; 90 /** 91 * Returns whether the Set object contains elements 92 * 93 * @returns { boolean } the boolean type 94 * @throws { BusinessError } 10200011 - The isEmpty method cannot be bound. 95 * @syscap SystemCapability.Utils.Lang 96 * @since 8 97 */ 98 /** 99 * Returns whether the Set object contains elements 100 * 101 * @returns { boolean } the boolean type 102 * @throws { BusinessError } 10200011 - The isEmpty method cannot be bound. 103 * @syscap SystemCapability.Utils.Lang 104 * @crossplatform 105 * @since 10 106 */ 107 /** 108 * Returns whether the Set object contains elements 109 * 110 * @returns { boolean } the boolean type 111 * @throws { BusinessError } 10200011 - The isEmpty method cannot be bound. 112 * @syscap SystemCapability.Utils.Lang 113 * @crossplatform 114 * @atomicservice 115 * @since 12 116 */ 117 isEmpty(): boolean; 118 /** 119 * Returns whether the Set object contain s the elements 120 * 121 * @param { T } value - value value need to determine whether to include the element 122 * @returns { boolean } the boolean type 123 * @throws { BusinessError } 10200011 - The has method cannot be bound. 124 * @throws { BusinessError } 401 - Parameter error. Possible causes: 125 * 1.Mandatory parameters are left unspecified; 126 * 2.Incorrect parameter types; 127 * 3.Parameter verification failed. 128 * @syscap SystemCapability.Utils.Lang 129 * @since 8 130 */ 131 /** 132 * Returns whether the Set object contain s the elements 133 * 134 * @param { T } value - value value need to determine whether to include the element 135 * @returns { boolean } the boolean type 136 * @throws { BusinessError } 10200011 - The has method cannot be bound. 137 * @throws { BusinessError } 401 - Parameter error. Possible causes: 138 * 1.Mandatory parameters are left unspecified; 139 * 2.Incorrect parameter types; 140 * 3.Parameter verification failed. 141 * @syscap SystemCapability.Utils.Lang 142 * @crossplatform 143 * @since 10 144 */ 145 /** 146 * Returns whether the Set object contain s the elements 147 * 148 * @param { T } value - value value need to determine whether to include the element 149 * @returns { boolean } the boolean type 150 * @throws { BusinessError } 10200011 - The has method cannot be bound. 151 * @throws { BusinessError } 401 - Parameter error. Possible causes: 152 * 1.Mandatory parameters are left unspecified; 153 * 2.Incorrect parameter types; 154 * 3.Parameter verification failed. 155 * @syscap SystemCapability.Utils.Lang 156 * @crossplatform 157 * @atomicservice 158 * @since 12 159 */ 160 has(value: T): boolean; 161 /** 162 * If the set does not contain the element, the specified element is added 163 * 164 * @param { T } value - value value Added element 165 * @returns { boolean } the boolean type(Is there contain this element) 166 * @throws { BusinessError } 10200011 - The add method cannot be bound. 167 * @throws { BusinessError } 401 - Parameter error. Possible causes: 168 * 1.Mandatory parameters are left unspecified; 169 * 2.Incorrect parameter types; 170 * 3.Parameter verification failed. 171 * @syscap SystemCapability.Utils.Lang 172 * @since 8 173 */ 174 /** 175 * If the set does not contain the element, the specified element is added 176 * 177 * @param { T } value - value value Added element 178 * @returns { boolean } the boolean type(Is there contain this element) 179 * @throws { BusinessError } 10200011 - The add method cannot be bound. 180 * @throws { BusinessError } 401 - Parameter error. Possible causes: 181 * 1.Mandatory parameters are left unspecified; 182 * 2.Incorrect parameter types; 183 * 3.Parameter verification failed. 184 * @syscap SystemCapability.Utils.Lang 185 * @crossplatform 186 * @since 10 187 */ 188 /** 189 * If the set does not contain the element, the specified element is added 190 * 191 * @param { T } value - value value Added element 192 * @returns { boolean } the boolean type(Is there contain this element) 193 * @throws { BusinessError } 10200011 - The add method cannot be bound. 194 * @throws { BusinessError } 401 - Parameter error. Possible causes: 195 * 1.Mandatory parameters are left unspecified; 196 * 2.Incorrect parameter types; 197 * 3.Parameter verification failed. 198 * @syscap SystemCapability.Utils.Lang 199 * @crossplatform 200 * @atomicservice 201 * @since 12 202 */ 203 add(value: T): boolean; 204 /** 205 * Remove a specified element from a Set object 206 * 207 * @param { T } value - value value Target to be deleted 208 * @returns { boolean } the boolean type(Is there contain this element) 209 * @throws { BusinessError } 10200011 - The remove method cannot be bound. 210 * @throws { BusinessError } 401 - Parameter error. Possible causes: 211 * 1.Mandatory parameters are left unspecified; 212 * 2.Incorrect parameter types; 213 * 3.Parameter verification failed. 214 * @syscap SystemCapability.Utils.Lang 215 * @since 8 216 */ 217 /** 218 * Remove a specified element from a Set object 219 * 220 * @param { T } value - value value Target to be deleted 221 * @returns { boolean } the boolean type(Is there contain this element) 222 * @throws { BusinessError } 10200011 - The remove method cannot be bound. 223 * @throws { BusinessError } 401 - Parameter error. Possible causes: 224 * 1.Mandatory parameters are left unspecified; 225 * 2.Incorrect parameter types; 226 * 3.Parameter verification failed. 227 * @syscap SystemCapability.Utils.Lang 228 * @crossplatform 229 * @since 10 230 */ 231 /** 232 * Remove a specified element from a Set object 233 * 234 * @param { T } value - value value Target to be deleted 235 * @returns { boolean } the boolean type(Is there contain this element) 236 * @throws { BusinessError } 10200011 - The remove method cannot be bound. 237 * @throws { BusinessError } 401 - Parameter error. Possible causes: 238 * 1.Mandatory parameters are left unspecified; 239 * 2.Incorrect parameter types; 240 * 3.Parameter verification failed. 241 * @syscap SystemCapability.Utils.Lang 242 * @crossplatform 243 * @atomicservice 244 * @since 12 245 */ 246 remove(value: T): boolean; 247 /** 248 * Clears all element groups in a set 249 * 250 * @throws { BusinessError } 10200011 - The clear method cannot be bound. 251 * @syscap SystemCapability.Utils.Lang 252 * @since 8 253 */ 254 /** 255 * Clears all element groups in a set 256 * 257 * @throws { BusinessError } 10200011 - The clear method cannot be bound. 258 * @syscap SystemCapability.Utils.Lang 259 * @crossplatform 260 * @since 10 261 */ 262 /** 263 * Clears all element groups in a set 264 * 265 * @throws { BusinessError } 10200011 - The clear method cannot be bound. 266 * @syscap SystemCapability.Utils.Lang 267 * @crossplatform 268 * @atomicservice 269 * @since 12 270 */ 271 clear(): void; 272 /** 273 * Executes a provided function once for each value in the Set object. 274 * 275 * @param { function } callbackFn - callbackFn 276 * callbackFn (required) A function that accepts up to three arguments. 277 * The function to be called for each element. 278 * @param { Object } [thisArg] - thisArg 279 * thisArg (Optional) The value to be used as this value for when callbackFn is called. 280 * If thisArg is omitted, undefined is used as the this value. 281 * @throws { BusinessError } 10200011 - The forEach method cannot be bound. 282 * @throws { BusinessError } 401 - Parameter error. Possible causes: 283 * 1.Mandatory parameters are left unspecified; 284 * 2.Incorrect parameter types. 285 * @syscap SystemCapability.Utils.Lang 286 * @since 8 287 */ 288 /** 289 * Executes a provided function once for each value in the Set object. 290 * 291 * @param { function } callbackFn - callbackFn 292 * callbackFn (required) A function that accepts up to three arguments. 293 * The function to be called for each element. 294 * @param { Object } [thisArg] - thisArg 295 * thisArg (Optional) The value to be used as this value for when callbackFn is called. 296 * If thisArg is omitted, undefined is used as the this value. 297 * @throws { BusinessError } 10200011 - The forEach method cannot be bound. 298 * @throws { BusinessError } 401 - Parameter error. Possible causes: 299 * 1.Mandatory parameters are left unspecified; 300 * 2.Incorrect parameter types. 301 * @syscap SystemCapability.Utils.Lang 302 * @crossplatform 303 * @since 10 304 */ 305 /** 306 * Executes a provided function once for each value in the Set object. 307 * 308 * @param { function } callbackFn - callbackFn 309 * callbackFn (required) A function that accepts up to three arguments. 310 * The function to be called for each element. 311 * @param { Object } [thisArg] - thisArg 312 * thisArg (Optional) The value to be used as this value for when callbackFn is called. 313 * If thisArg is omitted, undefined is used as the this value. 314 * @throws { BusinessError } 10200011 - The forEach method cannot be bound. 315 * @throws { BusinessError } 401 - Parameter error. Possible causes: 316 * 1.Mandatory parameters are left unspecified; 317 * 2.Incorrect parameter types. 318 * @syscap SystemCapability.Utils.Lang 319 * @crossplatform 320 * @atomicservice 321 * @since 12 322 */ 323 forEach(callbackFn: (value?: T, key?: T, set?: HashSet<T>) => void, thisArg?: Object): void; 324 /** 325 * Returns a new Iterator object that contains the values contained in this set 326 * 327 * @returns { IterableIterator<T> } 328 * @throws { BusinessError } 10200011 - The values method cannot be bound. 329 * @syscap SystemCapability.Utils.Lang 330 * @since 8 331 */ 332 /** 333 * Returns a new Iterator object that contains the values contained in this set 334 * 335 * @returns { IterableIterator<T> } 336 * @throws { BusinessError } 10200011 - The values method cannot be bound. 337 * @syscap SystemCapability.Utils.Lang 338 * @crossplatform 339 * @since 10 340 */ 341 /** 342 * Returns a new Iterator object that contains the values contained in this set 343 * 344 * @returns { IterableIterator<T> } 345 * @throws { BusinessError } 10200011 - The values method cannot be bound. 346 * @syscap SystemCapability.Utils.Lang 347 * @crossplatform 348 * @atomicservice 349 * @since 12 350 */ 351 values(): IterableIterator<T>; 352 /** 353 * Returns a new Iterator object that contains the [key, value] pairs for each element in the Set object in insertion order 354 * 355 * @returns { IterableIterator<[T, T]> } 356 * @throws { BusinessError } 10200011 - The entries method cannot be bound. 357 * @syscap SystemCapability.Utils.Lang 358 * @since 8 359 */ 360 /** 361 * Returns a new Iterator object that contains the [key, value] pairs for each element in the Set object in insertion order 362 * 363 * @returns { IterableIterator<[T, T]> } 364 * @throws { BusinessError } 10200011 - The entries method cannot be bound. 365 * @syscap SystemCapability.Utils.Lang 366 * @crossplatform 367 * @since 10 368 */ 369 /** 370 * Returns a new Iterator object that contains the [key, value] pairs for each element in the Set object in insertion order 371 * 372 * @returns { IterableIterator<[T, T]> } 373 * @throws { BusinessError } 10200011 - The entries method cannot be bound. 374 * @syscap SystemCapability.Utils.Lang 375 * @crossplatform 376 * @atomicservice 377 * @since 12 378 */ 379 entries(): IterableIterator<[T, T]>; 380 /** 381 * returns an iterator.Each item of the iterator is a Javascript Object 382 * 383 * @returns { IterableIterator<T> } 384 * @throws { BusinessError } 10200011 - The Symbol.iterator method cannot be bound. 385 * @syscap SystemCapability.Utils.Lang 386 * @since 8 387 */ 388 /** 389 * returns an iterator.Each item of the iterator is a Javascript Object 390 * 391 * @returns { IterableIterator<T> } 392 * @throws { BusinessError } 10200011 - The Symbol.iterator method cannot be bound. 393 * @syscap SystemCapability.Utils.Lang 394 * @crossplatform 395 * @since 10 396 */ 397 /** 398 * returns an iterator.Each item of the iterator is a Javascript Object 399 * 400 * @returns { IterableIterator<T> } 401 * @throws { BusinessError } 10200011 - The Symbol.iterator method cannot be bound. 402 * @syscap SystemCapability.Utils.Lang 403 * @crossplatform 404 * @atomicservice 405 * @since 12 406 */ 407 [Symbol.iterator](): IterableIterator<T>; 408} 409 410export default HashSet; 411