/* * Copyright (c) 2021-2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * HashSet is implemented based on HashMap. In HashSet, only the value object is processed. * * @namespace HashSet * @syscap SystemCapability.Utils.Lang * @since 8 */ /** * HashSet is implemented based on HashMap. In HashSet, only the value object is processed. * * @namespace HashSet * @syscap SystemCapability.Utils.Lang * @crossplatform * @since 10 */ declare class HashSet { /** * A constructor used to create a HashSet object. * * @throws { BusinessError } 10200012 - The HashSet's constructor cannot be directly invoked. * @syscap SystemCapability.Utils.Lang * @since 8 */ /** * A constructor used to create a HashSet object. * * @throws { BusinessError } 10200012 - The HashSet's constructor cannot be directly invoked. * @syscap SystemCapability.Utils.Lang * @crossplatform * @since 10 */ constructor(); /** * Gets the element number of the hashset. * * @syscap SystemCapability.Utils.Lang * @since 8 */ /** * Gets the element number of the hashset. * * @syscap SystemCapability.Utils.Lang * @crossplatform * @since 10 */ length: number; /** * Returns whether the Set object contains elements * * @returns { boolean } the boolean type * @throws { BusinessError } 10200011 - The isEmpty method cannot be bound. * @syscap SystemCapability.Utils.Lang * @since 8 */ /** * Returns whether the Set object contains elements * * @returns { boolean } the boolean type * @throws { BusinessError } 10200011 - The isEmpty method cannot be bound. * @syscap SystemCapability.Utils.Lang * @crossplatform * @since 10 */ isEmpty(): boolean; /** * Returns whether the Set object contain s the elements * * @param { T } value - value value need to determine whether to include the element * @returns { boolean } the boolean type * @throws { BusinessError } 10200011 - The has method cannot be bound. * @throws { BusinessError } 401 - The type of parameters are invalid. * @syscap SystemCapability.Utils.Lang * @since 8 */ /** * Returns whether the Set object contain s the elements * * @param { T } value - value value need to determine whether to include the element * @returns { boolean } the boolean type * @throws { BusinessError } 10200011 - The has method cannot be bound. * @throws { BusinessError } 401 - The type of parameters are invalid. * @syscap SystemCapability.Utils.Lang * @crossplatform * @since 10 */ has(value: T): boolean; /** * If the set does not contain the element, the specified element is added * * @param { T } value - value value Added element * @returns { boolean } the boolean type(Is there contain this element) * @throws { BusinessError } 10200011 - The add method cannot be bound. * @throws { BusinessError } 401 - The type of parameters are invalid. * @syscap SystemCapability.Utils.Lang * @since 8 */ /** * If the set does not contain the element, the specified element is added * * @param { T } value - value value Added element * @returns { boolean } the boolean type(Is there contain this element) * @throws { BusinessError } 10200011 - The add method cannot be bound. * @throws { BusinessError } 401 - The type of parameters are invalid. * @syscap SystemCapability.Utils.Lang * @crossplatform * @since 10 */ add(value: T): boolean; /** * Remove a specified element from a Set object * * @param { T } value - value value Target to be deleted * @returns { boolean } the boolean type(Is there contain this element) * @throws { BusinessError } 10200011 - The remove method cannot be bound. * @throws { BusinessError } 401 - The type of parameters are invalid. * @syscap SystemCapability.Utils.Lang * @since 8 */ /** * Remove a specified element from a Set object * * @param { T } value - value value Target to be deleted * @returns { boolean } the boolean type(Is there contain this element) * @throws { BusinessError } 10200011 - The remove method cannot be bound. * @throws { BusinessError } 401 - The type of parameters are invalid. * @syscap SystemCapability.Utils.Lang * @crossplatform * @since 10 */ remove(value: T): boolean; /** * Clears all element groups in a set * * @throws { BusinessError } 10200011 - The clear method cannot be bound. * @syscap SystemCapability.Utils.Lang * @since 8 */ /** * Clears all element groups in a set * * @throws { BusinessError } 10200011 - The clear method cannot be bound. * @syscap SystemCapability.Utils.Lang * @crossplatform * @since 10 */ clear(): void; /** * Executes a provided function once for each value in the Set object. * * @param { (value?: T, key?: T, set?: HashSet) => void } callbackFn - callbackFn callbackFn * @param { Object } thisArg * @throws { BusinessError } 10200011 - The forEach method cannot be bound. * @throws { BusinessError } 401 - The type of parameters are invalid. * @syscap SystemCapability.Utils.Lang * @since 8 */ /** * Executes a provided function once for each value in the Set object. * * @param { (value?: T, key?: T, set?: HashSet) => void } callbackFn - callbackFn callbackFn * @param { Object } thisArg * @throws { BusinessError } 10200011 - The forEach method cannot be bound. * @throws { BusinessError } 401 - The type of parameters are invalid. * @syscap SystemCapability.Utils.Lang * @crossplatform * @since 10 */ forEach(callbackFn: (value?: T, key?: T, set?: HashSet) => void, thisArg?: Object): void; /** * Returns a new Iterator object that contains the values contained in this set * * @returns { IterableIterator } * @throws { BusinessError } 10200011 - The values method cannot be bound. * @syscap SystemCapability.Utils.Lang * @since 8 */ /** * Returns a new Iterator object that contains the values contained in this set * * @returns { IterableIterator } * @throws { BusinessError } 10200011 - The values method cannot be bound. * @syscap SystemCapability.Utils.Lang * @crossplatform * @since 10 */ values(): IterableIterator; /** * Returns a new Iterator object that contains the [key, value] pairs for each element in the Set object in insertion order * * @returns { IterableIterator<[T, T]> } * @throws { BusinessError } 10200011 - The entries method cannot be bound. * @syscap SystemCapability.Utils.Lang * @since 8 */ /** * Returns a new Iterator object that contains the [key, value] pairs for each element in the Set object in insertion order * * @returns { IterableIterator<[T, T]> } * @throws { BusinessError } 10200011 - The entries method cannot be bound. * @syscap SystemCapability.Utils.Lang * @crossplatform * @since 10 */ entries(): IterableIterator<[T, T]>; /** * returns an iterator.Each item of the iterator is a Javascript Object * * @returns { IterableIterator } * @throws { BusinessError } 10200011 - The Symbol.iterator method cannot be bound. * @syscap SystemCapability.Utils.Lang * @since 8 */ /** * returns an iterator.Each item of the iterator is a Javascript Object * * @returns { IterableIterator } * @throws { BusinessError } 10200011 - The Symbol.iterator method cannot be bound. * @syscap SystemCapability.Utils.Lang * @crossplatform * @since 10 */ [Symbol.iterator](): IterableIterator; } export default HashSet;