Deque
Object Hierarchy:
Description:
[
GenericAccessors ]
public interface Deque<
G> :
Queue<
G>
A double-ended queue.
A deque can be used either as a queue (First-In-First-Out behavior) or as a stack (Last-In-First-Out behavior).
The methods defined by this interface behaves exactely in the same way as the Queue
methods with respect to capacity bounds.
The Deque interface inherits from the Queue interface. Thus, to use a deque as a queue,
you can equivalently use the following method set:
To use a deque as a stack, just use the method set that acts at the head of the deque:
Operation |
Deque method |
push an element |
offer_head |
peek an element |
peek_head |
pop an element |
poll_head |
All known implementing classes:
Content:
Methods:
- public abstract int drain_head (Collection<G> recipient, int amount = -1)
Drains the specified amount of elements from the head of this queue in
the specified recipient collection.
- public abstract int drain_tail (Collection<G> recipient, int amount = -1)
Drains the specified amount of elements from the tail of this queue in
the specified recipient collection.
- public abstract bool offer_head (G element)
Offers the specified element to the head of this deque.
- public abstract bool offer_tail (G element)
Offers the specified element to the tail of this deque
- public abstract G peek_head ()
Peeks (retrieves, but not remove) an element from this queue.
- public abstract G peek_tail ()
Peeks (retrieves, but not remove) an element from the tail of this
queue.
- public abstract G poll_head ()
Polls (retrieves and remove) an element from the head of this queue.
- public abstract G poll_tail ()
Polls (retrieves and remove) an element from the tail of this queue.
Inherited Members:
All known members inherited from interface Gee.Queue