Import std.collections.queue
std.collections.queue
A first-in, first-out queue.
Enqueue puts a value at the back, and Dequeue takes the one at the front. The values start at Head. Dequeue empties a value's slot as it takes it, so the value goes once the program lets go of it, and the empty slots are dropped once they're half.
std/collections/queue.fb
Types
Queue
class
@DebugElements Public Class Queue<T> Implements Iterable<T>, Cloneable, Defaultable
First in, first out: Enqueue puts a value at the back, and Dequeue takes the front one off.
Examples
Local turns = Queue<String>()
turns.Enqueue("knight")
turns.Enqueue("goblin")
Expect(turns.Dequeue() == "knight")
Expect(turns.Peek() == "goblin")std/collections/queue.fb, line 20
-
How many values it holds.
-
Puts
valueat the back. -
The same as Enqueue.
-
Enqueues each of the
values, in order. -
Takes the front value off and gives it. Panics when the Queue is empty.
-
The front value, which stays. Panics when the Queue is empty.
-
Takes the front value off and gives it, or Null when the Queue is empty.
-
The front value, which stays, or Null when the Queue is empty.
-
The values from the front, the order Dequeue gives them, in a new array.
-
Whether it holds
value. -
Takes every value out.
-
A new, empty Queue.
-
A new Queue with the same values.
-
The values from the front, the order Dequeue gives them. Changing the Queue while going over them panics.
QueueIterator
struct
Public Struct QueueIterator<T> Implements Iterator<T>
The values of a Queue, front first, which a For loop goes over.
std/collections/queue.fb, line 130
-
The next value, from the front to the back, or Null after the last. Panics when the Queue changed since the loop began.
Report an issue with this page or with FutureBlitz on GitHub.