Stack {collections}R Documentation

Stack

Description

The Stack class creates a stack with pairlist backend.

Usage

Stack

Format

An object of class R6ClassGenerator of length 24.

Usage

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

Argument

See Also

StackL

Examples

s <- Stack$new()
s$push("first")
s$push("second")
s$pop()  # second
s$pop()  # first

s <- Stack$new(list("foo", "bar"))
s$push("baz")$push("bla")

[Package collections version 0.1.6 Index]