@tsdotnet/queue - v1.3.1
    Preparing search index...

    Class default<T>

    Type Parameters

    • T

    Hierarchy

    • default<T>
      • default
    Index

    Constructors

    • Type Parameters

      • T

      Parameters

      • OptionalinitialEntries: T[]

      Returns default<T>

    Properties

    _array: T[]
    _head: number = 0
    _size: number = 0
    _tail: number = 0

    Accessors

    • get count(): number

      The number of items currently in the queue.

      Returns number

    • get isEmpty(): boolean

      Returns true if the queue is empty.

      Returns boolean

    Methods

    • Returns undefined | T

    • Parameters

      • item: T

      Returns void

    • Returns undefined | T

    • Clears the list.

      Returns number

    • Produces an iterable that dequeues items when iterated. Stops when empty.

      Returns Iterable<T>

    • Pulls an entry from the head of the queue and returns it. Returns undefined if the queue is already empty.

      Returns undefined | T

    • Pulls an entry from the head of the queue and returns it. Returns undefined if the queue is already empty and throwIfEmpty is false.

      Parameters

      • throwIfEmpty: true

      Returns T

      If the queue is already empty and throwIfEmpty is true.

    • Pulls an entry from the head of the queue and returns it. Returns undefined if the queue is already empty and throwIfEmpty is false.

      Parameters

      • throwIfEmpty: boolean

      Returns undefined | T

      If the queue is already empty and throwIfEmpty is true.

    • Clears the list.

      Returns void

    • Dequeues entries into an array.

      Parameters

      • max: number = Infinity

      Returns T[]

    • Adds an item to the end of the queue.

      Parameters

      • value: T

      Returns this

    • Adds items to the end of the queue.

      Parameters

      • values: Iterable<T>

      Returns this

    • Adds items to the end of the queue.

      Parameters

      • ...values: T[]

      Returns this

    • Returns the number of items contained in the collection by iterating the contents.

      Returns number

    • Returns the entry at the head of the queue. Returns undefined if the queue is already empty.

      Returns undefined | T

    • Returns the entry at the head of the queue. Returns undefined if the queue is already empty and throwIfEmpty is false.

      Parameters

      • throwIfEmpty: true

      Returns T

      If the queue is already empty and throwIfEmpty is true.

    • Returns the entry at the head of the queue. Returns undefined if the queue is already empty and throwIfEmpty is false.

      Parameters

      • throwIfEmpty: boolean

      Returns undefined | T

      If the queue is already empty and throwIfEmpty is true.

    • Clears the list.

      Returns void

    • Parameters

      • capacity: number

      Returns this

    • Trims excess items in the underlying array.

      Parameters

      • Optionalthreshold: number

      Returns void

    • Checks to see if the queue has entries an pulls an entry from the head of the queue and passes it to the out handler.

      Parameters

      • out: (value: T) => void

        The 'out' handler that receives the value if it exists.

      Returns boolean

      True if a value was retrieved. False if not.