collect-your-stuff
    Preparing search index...

    Class Queue<T>

    A first-in-first-out collection: items are added to the back with enqueue and taken from the front with dequeue. Any value can be queued (it is stored as it is, whether it is a function, an object or null), and adding and taking are constant time. To queue tasks which are run as they are taken use TaskQueue.

    Type Parameters

    • T = any

    Implements

    Index
    • Instantiate the queue, optionally with a list of items to start from.

      Type Parameters

      • T = any

      Parameters

      • queuedList: IsArrayable<any> = null

        The list of linkers to start in this queue (the first is the front)

      • listClass: any = LinkedList

        The type of list to create when no queued list is given

      • linkerClass: typeof Linker = Linker

        The class used to hold each queued item

      Returns Queue<T>

    queuedList: IsArrayable<any>

    The list which stores the queued items, the first is next to be dequeued.

    • Iterate over the items from the front of the queue to the back, without removing them.

      Returns Iterator<T>

    • Convert an array to a Queue, the first value is at the front.

      Type Parameters

      • T = any

      Parameters

      • values: T[] = []

        The items to queue

      • listClass: any = LinkedList

        The type of list used to store the items

      • linkerClass: typeof Linker = Linker

        The class used to hold each queued item

      Returns Queue<T>