UNPKG

typescript-ds-lib

Version:

A collection of TypeScript data structure implementations

27 lines (26 loc) 672 B
import { BaseCollection } from './base-collection'; export interface Queue<T> { push(element: T): void; pop(): T | undefined; front(): T | undefined; } export declare class Queue<T> extends BaseCollection<T> implements Queue<T> { private items; constructor(); /** * Checks if the queue is empty. Returns true if the queue is empty, false otherwise. */ isEmpty(): boolean; /** * Returns the number of elements in the queue. */ size(): number; /** * Removes all elements from the queue. */ clear(): void; /** * Checks if two queues are equal. */ equals(other: Queue<T>): boolean; }