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 16declare class HashSet<T> { 17 /** 18 * A constructor used to create a HashSet object. 19 * @throws { BusinessError } 10200012 - The HashSet's constructor cannot be directly invoked. 20 * @since 8 21 * @syscap SystemCapability.Utils.Lang 22 */ 23 constructor(); 24 /** 25 * Gets the element number of the hashset. 26 * @since 8 27 * @syscap SystemCapability.Utils.Lang 28 */ 29 length: number; 30 /** 31 * Returns whether the Set object contains elements 32 * @returns the boolean type 33 * @throws { BusinessError } 10200011 - The isEmpty method cannot be bound. 34 * @since 8 35 * @syscap SystemCapability.Utils.Lang 36 */ 37 isEmpty(): boolean; 38 /** 39 * Returns whether the Set object contain s the elements 40 * @param value need to determine whether to include the element 41 * @returns the boolean type 42 * @throws { BusinessError } 10200011 - The has method cannot be bound. 43 * @throws { BusinessError } 401 - The type of parameters are invalid. 44 * @since 8 45 * @syscap SystemCapability.Utils.Lang 46 */ 47 has(value: T): boolean; 48 /** 49 * If the set does not contain the element, the specified element is added 50 * @param value Added element 51 * @returns the boolean type(Is there contain this element) 52 * @throws { BusinessError } 10200011 - The add method cannot be bound. 53 * @throws { BusinessError } 401 - The type of parameters are invalid. 54 * @since 8 55 * @syscap SystemCapability.Utils.Lang 56 */ 57 add(value: T): boolean; 58 /** 59 * Remove a specified element from a Set object 60 * @param value Target to be deleted 61 * @returns the boolean type(Is there contain this element) 62 * @throws { BusinessError } 10200011 - The remove method cannot be bound. 63 * @throws { BusinessError } 401 - The type of parameters are invalid. 64 * @since 8 65 * @syscap SystemCapability.Utils.Lang 66 */ 67 remove(value: T): boolean; 68 /** 69 * Clears all element groups in a set 70 * @throws { BusinessError } 10200011 - The clear method cannot be bound. 71 * @since 8 72 * @syscap SystemCapability.Utils.Lang 73 */ 74 clear(): void; 75 /** 76 * Executes a provided function once for each value in the Set object. 77 * @throws { BusinessError } 10200011 - The forEach method cannot be bound. 78 * @throws { BusinessError } 401 - The type of parameters are invalid. 79 * @since 8 80 * @syscap SystemCapability.Utils.Lang 81 */ 82 forEach(callbackFn: (value?: T, key?: T, set?: HashSet<T>) => void, 83 thisArg?: Object): void; 84 /** 85 * Returns a new Iterator object that contains the values contained in this set 86 * @throws { BusinessError } 10200011 - The values method cannot be bound. 87 * @since 8 88 * @syscap SystemCapability.Utils.Lang 89 */ 90 values(): IterableIterator<T>; 91 /** 92 * Returns a new Iterator object that contains the [key, value] pairs for each element in the Set object in insertion order 93 * @throws { BusinessError } 10200011 - The entries method cannot be bound. 94 * @since 8 95 * @syscap SystemCapability.Utils.Lang 96 */ 97 entries(): IterableIterator<[T, T]>; 98 /** 99 * returns an iterator.Each item of the iterator is a Javascript Object 100 * @throws { BusinessError } 10200011 - The Symbol.iterator method cannot be bound. 101 * @since 8 102 * @syscap SystemCapability.Utils.Lang 103 */ 104 [Symbol.iterator](): IterableIterator<T>; 105} 106 107export default HashSet; 108