Learn R Programming

collections (version 0.1.6)

Queue: Queue

Description

The Queue class creates a queue with pairlist backend.

Usage

Queue

Format

An object of class R6ClassGenerator of length 24.

Usage

Queue$new(items = NULL)
Queue$push(item)
Queue$pop()
Queue$peek()
Queue$clear()
Queue$size()
Queue$as_list()

Argument

  • items: initialization list

  • item: any R object

See Also

QueueL

Examples

Run this code
# NOT RUN {
q <- Queue$new()
q$push("first")
q$push("second")
q$pop()  # first
q$pop()  # second

q <- Queue$new(list("foo", "bar"))
q$push("baz")$push("bla")
# }

Run the code above in your browser using DataLab