class Deque
pub class Deque<T> :: [Index<int>, Length, Iterable]
Conforms to Index<int>, Length, Iterable, FromArrayLiteral<T>, Equatable, Debug, Display, FromIterator<T>, Clone.
A double-ended queue: values pushed and popped at either end in amortized constant time.
The values lie in a ring buffer that doubles when full. deque[i] counts from the front; an
iterator walks front to back. Not safe across threads.
Panics
deque[i] panics outside 0 ≤ i < length().
Methods
pub static fn new(): Deque<T>
Creates an empty deque.
pub static fn withCapacity(n: int): Deque<T>
Creates an empty deque with room for n values before it grows.
Panics
When n is negative.
pub fn length(): int
Returns how many values it holds.
pub fn isEmpty(): bool
Returns whether it holds no values.
pub mut fn pushBack(v: T): void
Appends v at the back.
pub mut fn pushFront(v: T): void
Prepends v at the front.
pub mut fn popFront(): ?T
Removes and returns the front value, or null where there is none.
pub mut fn popBack(): ?T
Removes and returns the back value, or null where there is none.
pub fn peekFront(): ?T
Returns the front value without removing it, or null where there is none.
pub fn peekBack(): ?T
Returns the back value without removing it, or null where there is none.
pub fn index(i: int): T
Returns the value i places from the front; this is deque[i].
Panics
Outside 0 ≤ i < length(), with LYR-RT0003.
pub fn iter(): DequeIter<T>
Returns an iterator over the values, front to back.
Panics
The next pull panics (LYR-RT0016) after a push or a pop while the iterator walks.
static fn fromLiteral(items: T[]): Deque<T>
fn equals(o: Deque<T>): bool
fn debug(): string
fn debugTo(out: StringBuilder): void
fn show(): string
fn showTo(out: StringBuilder): void
static fn fromIter<I :: [Iterator<Item = T>]>(it: I): Deque<T> throws I.Error
fn clone(): Deque<T>