A Wrapper for fastmap::fastqueue
Arguments
- init, missing_default
passed to
fastmap::fastqueue
- x
a
'fastqueue2'
object- i, j
integer index
- ...
integer indices or passed to other methods
Examples
x <- fastqueue2()
# add elements
x$madd(1, "b", function(){ "c" }, 4, "5")
# print information
print(x)
#> <Queue, size=5>
# get the second element without changing the queue
x[[2]]
#> [1] "b"
# remove and get the first element
x$remove()
#> [1] 1
# the second item
x[[2]]
#> function ()
#> {
#> "c"
#> }
#> <environment: 0x5591bafefc68>
# first two items in a list
x[c(1,2)]
#> [[1]]
#> [1] "b"
#>
#> [[2]]
#> function ()
#> {
#> "c"
#> }
#> <environment: 0x5591bafefc68>
#>
print(x)
#> <Queue, size=4>
as.list(x)
#> [[1]]
#> [1] "b"
#>
#> [[2]]
#> function ()
#> {
#> "c"
#> }
#> <environment: 0x5591bafefc68>
#>
#> [[3]]
#> [1] 4
#>
#> [[4]]
#> [1] "5"
#>