Queue

interface Queue<T>(source)

Represents a queue data structure that follows the FIFO (First-In-First-Out) principle.

Inheritors

Properties

Link copied to clipboard
abstract val size: Int

Returns the number of elements in the queue.

Functions

Link copied to clipboard
abstract suspend fun dequeue(): Node<T>

Dequeues the head element from the queue.

Link copied to clipboard
abstract suspend fun enqueue(value: T): Node<T>

Enqueues a new element into the queue.

Link copied to clipboard
abstract suspend fun headCondition(cond: (T) -> Boolean): Boolean

Checks if the given condition on the head element of the queue is satisfied.

Link copied to clipboard
abstract suspend fun remove(node: Node<T>)

Removes a specific node from the queue.