A prefix to use for every key of this map.
Deletes all entries.
Checks whether the map contains a given key
let map = new PersistentUnorderedMap<string, string>("m")
map.contains("hello") // false
map.set("hello", "world")
map.contains("hello") // true
Key to check.
True if the given key present in the map.
Removes the given key and related value from the map
let map = new PersistentUnorderedMap<string, string>("m")
map.set("hello", "world")
map.delete("hello")
Removes value and the key from the map.
Key to remove.
Returns range of entries from start index to end exclusive
index of starting entries
index of end entries
Retrieves the related value for a given key, or uses the defaultValue
if not key is found
let map = new PersistentUnorderedMap<string, string>("m")
map.set("hello", "world")
let found = map.get("hello")
let notFound = map.get("goodbye", "cruel world")
assert(found == "world")
assert(notFound == "cruel world")
Key of the element.
The default value if the key is not present.
Value for the given key or the default value.
Retrieves a related value for a given key or fails assertion with "key not found"
let map = new PersistentUnorderedMap<string, string>("m")
map.set("hello", "world")
let result = map.getSome("hello")
// map.getSome("goodbye") // will throw with failed assertion
assert(result == "world")
Key of the element.
Value for the given key or throws
Returns range of keys from start index to end exclusive
index of starting keys
index of end keys
returns a MapEntry array of number of last entries.
Pops the last entry added to the map.
```ts let map = new PersistentUnorderedMap<string, string>("m")
map.set("hello", "world")
```
Sets the new value for the given key.
Key of the element.
The new value of the element.
Returns range of values from start index to end exclusive
index of starting values
index of end values
Generated using TypeDoc
Creates or restores a persistent unordered map with a given storage prefix. Always use a unique storage prefix for different collections.
Example
let map = new PersistentUnorderedMap<string, string>("m") // note the prefix must be unique (per NEAR account)