Import std.collections.deque
std.collections.deque
A double-ended queue, which adds and takes values at either end.
Front holds the first values backwards, so both ends are at the end of an array, and when one side runs out as values are taken, it takes half of the other.
std/collections/deque.fb
Types
Deque
class
@DebugElements Public Class Deque<T> Implements Iterable<T>, Cloneable, Defaultable
A double-ended queue: values go on and come off at either end.
Examples
Local deque = Deque<Int>()
deque.AddLast(2)
deque.AddFirst(1)
deque.AddLast(3)
Expect(deque.RemoveFirst() == 1)
Expect(deque.RemoveLast() == 3)
Expect(deque.ToArray() == [2])std/collections/deque.fb, line 22
-
How many values it holds.
-
Puts
valueat the front. A Deque holds at most 2147483647 values, as many as its Int Count counts, as an array does, and one more panics. -
Puts
valueat the back. A Deque holds at most 2147483647 values, as many as its Int Count counts, as an array does, and one more panics. -
The same as AddLast.
-
Adds each of the
valueslast, in order. -
Takes the first value off and gives it. Panics when the Deque is empty.
-
Takes the last value off and gives it. Panics when the Deque is empty.
-
The first value, which stays, as everything else does. Panics when the Deque is empty.
-
The last value, which stays, as everything else does. Panics when the Deque is empty.
-
Takes the first value off and gives it, or Null when the Deque is empty.
-
Takes the last value off and gives it, or Null when the Deque is empty.
-
The first value, which stays, or Null when the Deque is empty.
-
The last value, which stays, or Null when the Deque is empty.
-
The value at index, counting from the first, which is 0. Panics unless index is from 0 to Count minus 1.
-
Gives the value at index, counting from the first, a new value. Panics unless index is from 0 to Count minus 1.
-
Whether it holds
value. -
The values from first to last, in a new array.
-
Takes every value out.
-
A new, empty Deque.
-
A new Deque with the same values.
-
The values from first to last. Adding or removing a value while going over them panics.
DequeIterator
struct
Public Struct DequeIterator<T> Implements Iterator<T>
The values of a Deque, from the first to the last, which a For loop goes over.
std/collections/deque.fb, line 219
-
The next value, from the first to the last, or Null after it. Panics when the Deque changed since the loop began.
Report an issue with this page or with FutureBlitz on GitHub.