| clone {hashmap} | R Documentation |
clone creates a deep copy of a Hashmap so that
modifications made to the cloned object do not affect the original object.
clone(x)
x |
an object created by a call to |
Since the actual cloning is done in C++, y <- clone(x) should
be much more efficient than y <- hashmap(x$keys(), x$values()).
a Hashmap identical to the input object.
x <- hashmap(letters[1:5], 1:5) ## shallow copy y <- x y[["a"]] <- 999 ## original is affected x[["a"]] == 999 z <- clone(x) z[["c"]] <- 888 ## original not affected x[["c"]] == 888