Learn R Programming

collections (version 0.2.5)

Queue: Queue

Description

The Queue function creates a queue.

Usage

Queue(items = NULL)

Arguments

items

a list of items

Details

Following methods are exposed:

.$push(item)
.$pop()
.$peek()
.$clear()
.$size()
.$as_list()
.$print()
  • item: any R object

See Also

QueueL

Examples

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

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

Run the code above in your browser using DataLab