ixfx
    Preparing search index...

    Interface IQueueImmutable<V>

    Queue (immutable). See also QueueMutable.

    Queues are useful if you want to treat 'older' or 'newer' items differently. Enqueing adds items at the back of the queue, while dequeing removes items from the front (ie. the oldest).

    let q = queue();           // Create
    q = q.enqueue(`a`, `b`); // Add two strings
    const front = q.peek; // `a` is at the front of queue (oldest)
    q = q.dequeue(); // q now just consists of `b`
    const q = queue({capacity: 5, discardPolicy: `newer`});
    
    interface IQueueImmutable<V> {
        get isEmpty(): boolean;
        get isFull(): boolean;
        get length(): number;
        get peek(): undefined | V;
        dequeue(): IQueueImmutable<V>;
        enqueue(...toAdd: readonly V[]): IQueueImmutable<V>;
        forEach(fn: (v: V) => void): void;
        forEachFromFront(fn: (v: V) => void): void;
        toArray(): V[];
    }

    Type Parameters

    • V

    Implemented by

    Index

    Accessors

    Methods