← Standard library

Queue

sealed class Queue<T>
import Queue from Wax;

A first-in, first-out collection.

Queue.wax:14

Inherits from object. Follow these links for inherited members.

Members

constructorconstructor

public constructor ()

Creates an empty collection. No elements are inserted.

Queue.wax:24

WithCapacityconstructor

public constructor WithCapacity (int32 capacity)

Creates an empty collection with reserved storage. Capacity reservation does not change the element count.

Queue.wax:37

sizegetter

public get size() : int32

The number of live elements.

Queue.wax:47

capacitygetter

public get capacity() : int32

The number of elements the current backing storage can hold before growth.

Queue.wax:54

EnsureCapacitymethod

public fn EnsureCapacity(int32 capacity) : void

Grows storage if needed to hold at least the requested total element count. Does not shrink storage or insert elements.

Queue.wax:92

EnsureAdditionalCapacitymethod

public fn EnsureAdditionalCapacity(int32 additional) : void

Reserves space for the current element count plus additional. Does not insert elements.

Queue.wax:99

Enqueuemethod

public fn Enqueue(T item) : void

Appends an item at the back, growing storage when necessary.

Queue.wax:106

Peekmethod

public fn Peek() : T

Returns the oldest queued item without removing it. Panics when empty.

Queue.wax:122

Dequeuemethod

public fn Dequeue() : T

Removes and returns the oldest queued item. Panics when empty. Removed references can remain retained by backing slots until overwritten or storage grows.

Queue.wax:138

TryDequeuemethod

public fn TryDequeue(out T? item) : bool

Returns true and removes the front item, including a stored null. When empty, returns false and writes null.

Queue.wax:154

DequeueOrNullmethod

public fn DequeueOrNull() : T?

Removes and returns the front item, or null if empty. Use TryDequeue to distinguish an empty queue from a dequeued null.

Queue.wax:168

Clearmethod

public fn Clear() : void

Empties the queue and retains capacity. Previously stored references can remain in backing slots until overwritten or a later growth replaces the buffer.

Queue.wax:179

ToArraymethod

public fn ToArray() : T[]

Returns a separate array snapshot in front-to-back order. Reference elements still point to the same objects.

Queue.wax:192

Containsmethod

public fn Contains(T item) : bool where T is Equatable

Scans live elements using Equals; returns false for an empty collection.

Queue.wax:206