Skip to content
FutureBlitz

    Install

    Import std.collections.deque

    Deque

    std.collections.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

    • Public Property Count: Int property #

      How many values it holds.

    • @PanicsAtCaller Public Method AddFirst(value: T) method #

      Puts value at the front. A Deque holds at most 2147483647 values, as many as its Int Count counts, as an array does, and one more panics.

    • @PanicsAtCaller Public Method AddLast(value: T) method #

      Puts value at the back. A Deque holds at most 2147483647 values, as many as its Int Count counts, as an array does, and one more panics.

    • @PanicsAtCaller Public Method Add(value: T) method #

      The same as AddLast.

    • @PanicsAtCaller Public Method AddAll(values: Iterable<T>) method #

      Adds each of the values last, in order.

    • @PanicsAtCaller Public Method RemoveFirst(): T method #

      Takes the first value off and gives it. Panics when the Deque is empty.

    • @PanicsAtCaller Public Method RemoveLast(): T method #

      Takes the last value off and gives it. Panics when the Deque is empty.

    • @PanicsAtCaller Public Method First(): T method #

      The first value, which stays, as everything else does. Panics when the Deque is empty.

    • @PanicsAtCaller Public Method Last(): T method #

      The last value, which stays, as everything else does. Panics when the Deque is empty.

    • Public Method TryRemoveFirst(): T? method #

      Takes the first value off and gives it, or Null when the Deque is empty.

    • Public Method TryRemoveLast(): T? method #

      Takes the last value off and gives it, or Null when the Deque is empty.

    • Public Method TryFirst(): T? method #

      The first value, which stays, or Null when the Deque is empty.

    • Public Method TryLast(): T? method #

      The last value, which stays, or Null when the Deque is empty.

    • @PanicsAtCaller Operator [](index: Int): T operator #

      The value at index, counting from the first, which is 0. Panics unless index is from 0 to Count minus 1.

    • @PanicsAtCaller Operator []=(index: Int, value: T) operator #

      Gives the value at index, counting from the first, a new value. Panics unless index is from 0 to Count minus 1.

    • Public Method Contains(value: T): Bool method #

      Whether it holds value.

    • Public Method ToArray(): T[] method #

      The values from first to last, in a new array.

    • Public Method Clear() method #

      Takes every value out.

    • Public Static Method DefaultValue(): Deque<T> static method #

      A new, empty Deque.

    • Public Method Clone(): Deque<T> method #

      A new Deque with the same values.

    • Public Method Iterate(): DequeIterator<T> method #

      The values from first to last. Adding or removing a value while going over them panics.

    Report an issue with this page or with FutureBlitz on GitHub.