UNPKG

dastal

Version:

Data Structures & Algorithms implementations

31 lines (30 loc) 838 B
import { List } from '../list'; import { Queue } from './queue'; /** * A linked list implementation of the {@link Queue} interface */ export declare class LinkedQueue<T> implements Queue<T> { /** * The list containing every element. */ protected list: List<T>; /** * Instantiate the queue. * * @param elements - A set of elements to initialize the queue with. */ constructor(elements?: Iterable<T>); clear(): void; dequeue(): T | undefined; enqueue(element: T): number; peek(): T | undefined; get size(): number; /** * Receive an iterator through the queue. * * **Note:** Unexpected behavior can occur if the collection is modified during iteration. * * @returns An iterator through the queue */ [Symbol.iterator](): Iterator<T>; }