Import std.collections.queue
std.collections.queue
Queue<T>: first in, first out. 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 as soon as 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 19
-
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 For ... In goes over.
std/collections/queue.fb, line 129
-
The next value, or Null when there are no more.
Doc from
std.core.iterator.Iterator.Next.
Report an issue with this page or with FutureBlitz on GitHub.