UNPKG

@cute-dw/core

Version:

This TypeScript library is the main part of a more powerfull package designed for the fast WEB software development. The cornerstone of the library is the **DataStore** class, which might be useful when you need a full control of the data, but do not need

82 lines (81 loc) 3.44 kB
import { Cloneable } from "../util/interface/Cloneable"; import { Element } from "./Collection"; import { AbstractSet } from "./AbstractSet"; /** * This class implements the `Set` interface. Set objects are collections of values. You can iterate through the elements of a set in * insertion order. A value in the `Set` may only occur once; it is unique in the Set's collection. */ export declare class HashSet<K> extends AbstractSet<K> implements Cloneable { private readonly _set; /** * @constructor * @param initSet If an _iterable_ object is passed, all of its elements will be added to the new HashSet. * If you don't specify this parameter, or its value is _null_, the new HashSet is empty. * @throws `IllegalArgumentException` if the initial set includes a key which value is _undefined_ */ constructor(initSet?: Set<K> | Iterable<K> | null); get size(): number; append(key: K): boolean; /** * Gets the copy of the current set object * @returns A new set object with the same values as this set */ clone(): HashSet<K>; delete(key: K): boolean; has(key: K): boolean; entries(): IterableIterator<[K, K]>; keys(): IterableIterator<K>; values(): IterableIterator<K>; forEach(callbackfn: (value: K, value2: K, set: Set<K>) => void, thisArg?: any): void; [Symbol.iterator](): IterableIterator<K>; clear(): void; contains(key: K): boolean; remove(key: K): boolean; toArray(): Element<K>[]; /** * Checks if the specified set is the sub set for the current set * @param setB Target set object to check * @returns _true_ if the target `setB` set is the sub set of this set, _false_ otherwise */ isSubSet(setB: Set<K>): boolean; /** * Checks if the specified set is the super set for the current set * @param setB Target set object to check * @returns _true_ if the target `setB` set is the super set of this set, _false_ otherwise */ isSuperSet(setB: Set<K>): boolean; /** * Gets the common values (intersection) with another set * @param setB Target set object for get the intersection * @returns New set object with common values * @see {@link retainAll} * @see {@link union} * @see {@link complement} */ intersection(setB: Set<K>): HashSet<K>; /** * Combines values with another set * @param setB Target set object for get the union * @returns New set object with combined values * @see {@link intersection} * @see {@link complement} */ union(setB: Set<K>): HashSet<K>; /** * Retrieves values from `this` set that are missing from another (relative complement) * @param setB Target set object for get the relative complement * @returns New set object of the missing values * @see {@link intersection} * @see {@link union} * @see {@link symmetricDifference} */ complement(setB: Set<K>): HashSet<K>; /** * Extracts values that are a combination of difference values from both sides of the comparison * @param setB Target set object for get the symmetric difference * @returns New set object of differences * @see {@link complement} */ symmetricDifference(setB: Set<K>): HashSet<K>; [Symbol.toStringTag]: string; }