Queue
sealed class Queue<T>import Queue from Wax;A first-in, first-out collection.
Inherits from object. Follow these links for inherited members.
Members
constructorconstructor
public constructor ()Creates an empty collection. No elements are inserted.
WithCapacityconstructor
public constructor WithCapacity (int32 capacity)Creates an empty collection with reserved storage. Capacity reservation does not change the element count.
sizegetter
public get size() : int32The number of live elements.
capacitygetter
public get capacity() : int32The number of elements the current backing storage can hold before growth.
EnsureCapacitymethod
public fn EnsureCapacity(int32 capacity) : voidGrows storage if needed to hold at least the requested total element count. Does not shrink storage or insert elements.
EnsureAdditionalCapacitymethod
public fn EnsureAdditionalCapacity(int32 additional) : voidReserves space for the current element count plus additional. Does not insert elements.
Enqueuemethod
public fn Enqueue(T item) : voidAppends an item at the back, growing storage when necessary.
Peekmethod
public fn Peek() : TReturns the oldest queued item without removing it. Panics when empty.
Dequeuemethod
public fn Dequeue() : TRemoves and returns the oldest queued item. Panics when empty. Removed references can remain retained by backing slots until overwritten or storage grows.
TryDequeuemethod
public fn TryDequeue(out T? item) : boolReturns true and removes the front item, including a stored null. When empty, returns false and writes null.
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.
Clearmethod
public fn Clear() : voidEmpties the queue and retains capacity. Previously stored references can remain in backing slots until overwritten or a later growth replaces the buffer.
ToArraymethod
public fn ToArray() : T[]Returns a separate array snapshot in front-to-back order. Reference elements still point to the same objects.
Containsmethod
public fn Contains(T item) : bool where T is EquatableScans live elements using Equals; returns false for an empty collection.