class Deque(T)

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

Defined in:

history.cr

Instance Method Summary

Instance Method Detail

def delete_element(obj) : T | Nil #

Add this method because unlike Array, Deque#delete return a Boolean instead of the element.


[View source]