Ordered containers with integer keys.
<- intmap$new(
imap keys = c(11, -2), values = list(c("a", "b"), list(333, 4444, 55555))
)
imap## `intmap` object containing 2 items:
##
## "-2" -> list: 333, 4444, 55555
## "11" -> character vector: a, b
$size()
imap## [1] 2
$keys()
imap## [1] -2 11
$values()
imap## [[1]]
## [[1]][[1]]
## [1] 333
##
## [[1]][[2]]
## [1] 4444
##
## [[1]][[3]]
## [1] 55555
##
##
## [[2]]
## [1] "a" "b"
$at(5)
imap## Nothing
$at(11)
imap## Just
## [1] "a" "b"
from_just(imap$at(11))
## [1] "a" "b"
get
method with a default value.$get(5, default = "I am missing.")
imap## [1] "I am missing."
$get(-2)
imap## [[1]]
## [1] 333
##
## [[2]]
## [1] 4444
##
## [[3]]
## [1] 55555
$insert(5, "I am not missing.")
imap## [1] TRUE
imap## `intmap` object containing 3 items:
##
## "-2" -> list: 333, 4444, 55555
## "5" -> character: I am not missing.
## "11" -> character vector: a, b
$extract(c(5, 11, 99999))
imap## `intmap` object containing 2 items:
##
## "5" -> character: I am not missing.
## "11" -> character vector: a, b
<- intmap$new(
imap2 c(-2, 0, 1),
list("I will be ignored", iris, mtcars)
)$merge(imap2)
imap
imap## `intmap` object containing 5 items:
##
## "-2" -> list: 333, 4444, 55555
## "0" -> data.frame
## "1" -> data.frame
## "5" -> character: I am not missing.
## "11" -> character vector: a, b