class Deque(T)
- Deque(T)
- Reference
- Object
Overview
A Deque ("double-ended queue") is a collection of objects of type T that behaves much like an Array.
Deque has a subset of Array's API. It performs better than an Array
when there are frequent insertions or deletions
of items near the beginning or the end.
The most typical use case of a Deque is a queue: use push
to add items to the end of the queue and shift
to get
and remove the item at the beginning of the queue.
This Deque is implemented with a dynamic array used as a circular buffer.
Included Modules
- Indexable::Mutable(T)
Defined in:
history.crInstance Method Summary
-
#delete_element(obj) : T | Nil
Add this method because unlike
Array
,Deque#delete
return a Boolean instead of the element.
Instance Method Detail
def delete_element(obj) : T | Nil
#
Add this method because unlike Array
, Deque#delete
return a Boolean instead of the element.