/** * A generic stack implementation providing standard stack operations. * Follows LIFO (Last In, First Out) principle. * * @template T The type of elements stored in the stack */ export declare class Stack { #private; /** * Adds an element to the top of the stack. * * @param item The item to push onto the stack * @returns The new size of the stack */ push(item: T): number; /** * Removes and returns the top element from the stack. * * @returns The top element, or undefined if the stack is empty */ pop(): T | undefined; /** * Returns the top element without removing it. * * @returns The top element, or undefined if the stack is empty */ peek(): T | undefined; /** * Returns the top element without removing it. * Alias for peek() method. * * @returns The top element, or undefined if the stack is empty */ top(): T | undefined; /** * Checks if the stack is empty. * * @returns True if the stack contains no elements, false otherwise */ isEmpty(): boolean; /** * Returns the number of elements in the stack. * * @returns The size of the stack */ get size(): number; /** * Returns the number of elements in the stack. * Alias for size property. * * @returns The length of the stack */ get length(): number; /** * Removes all elements from the stack. */ clear(): void; /** * Removes the first element that matches the predicate function. * Searches from top to bottom of the stack. * * @param predicate Function that tests each element for removal * @returns True if an element was removed, false if no match was found */ delete(predicate: (item: T) => boolean): boolean; /** * Returns a shallow copy of the stack as an array. * The first element in the array represents the bottom of the stack. * * @returns A copy of the internal array */ toArray(): T[]; /** * Creates a new stack from an array of items. * The first element in the array becomes the bottom of the stack. * * @param items Array of items to initialize the stack with * @returns A new Stack instance */ static fromArray(items: U[]): Stack; /** * Returns a string representation of the stack. * * @returns String representation showing stack contents */ toString(): string; /** * Allows iteration over the stack from top to bottom. * * @returns Iterator that yields elements from top to bottom */ [Symbol.iterator](): Iterator; /** * Returns an iterator that yields elements from bottom to top. * * @returns Iterator that yields elements from bottom to top */ bottomToTop(): Iterator; }