hashmap | R Documentation |

[hashmap()] constructs a hashmap, which is an object that behaves like an [environment] but can key on arbitrary objects rather than just characters.

```
hashmap()
## S3 method for class 'hashmap'
x[...]
## S3 replacement method for class 'hashmap'
x[...] <- value
## S3 method for class 'hashmap'
x[[...]]
## S3 replacement method for class 'hashmap'
x[[...]] <- value
keys(x, ...)
values(x, ...)
to_pairs(x, ...)
from_pairs(pairs)
hasKey(x, ...)
dropKey(x, ...)
```

`x` |
a hashmap object. |

`...` |
Any number of indices. |

`value` |
A replacement value for ‘[['; for ’[', a sequence of replacement values. |

`pairs` |
A list of pairs, the first element is treated as key and the second as value. |

You can use multiple indices in a hashmap; the effect is similar to indexing on a list containing all keys.

Type is significant; for instance, float '1' and integer '1L' are considered distinct indices. It is also permitted to index on NULL, NA, or the empty string.

The 'memo' package hashmap has a performance optimization over other implementations of this concept, in that the md5 digest is memoized on scalar and pointer values. That means that if you lookup using keys that are pointer-identical to previously seen keys, it will skip computing the digest a second time. Indexing using scalar values will also bypass the md5 hash.

'hashmap()' returns a newly constructed hashmap.

'pairs(x)' extracts from a hashmap a list of pairs, each pair being of the form 'list(key=, val=)'.

'hasKey(x)' returns TRUE if there is a key with the same digest as '...' that compares [identical()]

Peter Meilstrup

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.