Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Queue<T>

This class represent a message queue where messages can be added, removed and can query the state of the queue i.e. if the queue is currently empty or not.

Type parameters

  • T

Hierarchy

  • Queue

Index

Properties

Methods

Properties

messages

messages: T[] = []

The array storing the elements in the queue

Methods

add

  • add(message: T): void
  • Add a message to the messages queue.

    Parameters

    • message: T

      the message to be added

    Returns void

drain

  • drain(): T[]
  • Removes then returns all messages from the queue as an array.

    Returns T[]

    an array of removed messages

isEmpty

  • isEmpty(): boolean
  • Check if there are no more items in the queue

    Returns boolean

    true if the queue is empty

Copyright © 2025 DiffusionData Ltd. All Rights Reserved.