@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
24 lines (23 loc) • 1.35 kB
TypeScript
import { Collection, Element, ImmutableCollection } from "./Collection";
/**
* An immutable collection designed for holding elements prior to processing. Besides basic `ImmutableCollection` operations,
* immutable queues provide additional extraction and inspection operations.
*/
export interface ImmutableQueue<T> extends ImmutableCollection<T> {
/** Retrieves, but does not remove, the head of this queue, or returns `undefined` if this queue is empty */
element(): Element<T> | undefined;
/** Retrieves, but does not remove, the head of this queue, or returns `undefined` if this queue is empty */
peek(): Element<T> | undefined;
}
/**
* A mutable collection designed for holding elements prior to processing. Besides basic `Collection` operations, queues provide additional insertion,
* extraction, and inspection operations.
*/
export interface Queue<T> extends ImmutableQueue<T>, Collection<T> {
/** Inserts the specified element into this queue if it is possible */
offer(value: Element<T>): boolean;
/** Retrieves and removes the head of this queue, or returns `undefined` if this queue is empty */
poll(): Element<T> | undefined;
/** Retrieves and removes the head of this list, or returns `undefined` if this list object is empty */
removeFirst(): Element<T> | undefined;
}