deque: Double Ended Queue

View source: R/deque.R

dequeR Documentation

Double Ended Queue

Description

deque creates a double ended queue.

Usage

deque(items = NULL)

Arguments

items

a list of items

Details

Following methods are exposed:

.$push(item)
.$pushleft(item)
.$pop()
.$popleft()
.$peek()
.$peekleft()
.$extend(q)
.$extendleft(q)
.$remove(item)
.$clear()
.$size()
.$as_list()
.$print()
  • item: any R object

  • q: a deque object

See Also

queue and stack

Examples

q <- deque()
q$push("foo")
q$push("bar")
q$pushleft("baz")
q$pop()  # bar
q$popleft()  # baz

q <- deque(list("foo", "bar"))
q$push("baz")$pushleft("bla")

collections documentation built on Jan. 6, 2023, 1:25 a.m.