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:

objects.cr

Constructors

Instance Method Summary

Instance methods inherited from class Object

to_xml(io : IO, *, indent : XMLT::IndentOptions = nil) : Nil
to_xml(*, indent : XMLT::IndentOptions = nil) : String
to_xml

Class methods inherited from class Object

from_xml(xml : String)
from_xml(node : XML::Node)
from_xml(xml : String, *, root : String)
from_xml(node : XML::Node, *, root : String)
from_xml

Constructor Detail

def self.new(node : XML::Node) #

[View source]

Instance Method Detail

def to_xml(xml : XML::Builder, key : String) : Nil #

[View source]
def to_xml(io : IO, *, key : String = "item", indent : XMLT::IndentOptions = nil) : Nil #

[View source]
def to_xml(*, key : String = "item", indent : XMLT::IndentOptions = nil) : String #

[View source]