HashMap
An optimized in-memory key-value store, serving as a better performance replacement for default Scope implementation, designed for handling large data sets efficiently.
the speed gains will come at the expense of more memory usage
Import
_ <- fat.extra.HashMap
Constructor
Name | Signature | Brief |
---|---|---|
HashMap | (capacity: Number = 97) | Create a HashMap with a specified capacity |
Prototype members
Name | Signature | Brief |
---|---|---|
set | (key: Text, value: Any): Any | Set a key-value pair in the HashMap |
get | (key: Text): Any | Get the value associated with a key |
keys | (): List/Text | Return a list of all keys in the HashMap |
values | (): List/Any | Return a list of all values in the HashMap |
Example
_ <- fat.extra.HashMap
hmap = HashMap()
hmap.set('key1', 'value1')
hmap.get('key1') # yields 'value1'
hmap.keys # yields [ 'key1' ]
hmap.values # yields [ 'value1' ]