UNPKG

projen

Version:

CDK for software projects

65 lines (64 loc) 1.6 kB
/** * Represents a set of objects with a size limit. */ export declare class FixedSizeSet<T> { private _limit; private _items; /** * Initializes a new instance of `FixedSizeSet`. * * @param limit - maximum number of items to keep in the set. When the limit * is exceeded the first item is removed from the set. */ constructor(limit?: number); /** * Adds a new item to the set. * * @param item - an item */ add(item: T): this; /** * Removes an item from the set. * * @param item - an item */ delete(item: T): boolean; /** * Determines if an item is in the set. * * @param item - an item */ has(item: T): boolean; /** * Removes all items from the set. */ clear(): void; /** * Gets the number of items in the set. */ get size(): number; /** * Applies the given callback function to all elements of the set. */ forEach(callback: (value: T, value2: T, set: this) => void, thisArg?: any): void; /** * Iterates through the items in the set. */ keys(): Generator<T, void, unknown>; /** * Iterates through the items in the set. */ values(): Generator<T, void, unknown>; /** * Iterates through the items in the set. */ entries(): Generator<[T, T], void, unknown>; /** * Iterates through the items in the set. */ [Symbol.iterator](): Generator<T, void, unknown>; /** * Returns the string tag of the set. */ get [Symbol.toStringTag](): string; }