Welcome to @rimbu/multimap
! A Rimbu MultiMap is a powerful data structure where each key can have one or more unique values, stored in a Set
. This ensures that each key's associated values are unique and easily manageable.
- Multiple Values per Key: Each key can map to multiple unique values.
- Unique Values: Values for each key are stored in a
Set
, ensuring uniqueness. - Flexible Implementations: Choose between hashed and sorted implementations based on your needs.
Name | Description |
---|---|
HashMultiMapHashValue<K, V> |
A multimap with hashed keys and hashed values. |
HashMultiMapSortedValue<K, V> |
A multimap with hashed keys and sorted values. |
MultiMap<K, V> |
A generic multimap for keys of type K and values of type V . |
SortedMultiMapHashValue<K, V> |
A multimap with sorted keys and hashed values. |
SortedMultiMapSortedValue<K, V> |
A multimap with sorted keys and sorted values. |
VariantMultiMap<K, V> |
A type-variant multimap for keys of type K and values of type V . |
For complete documentation, please visit the MultiMap page in the Rimbu Docs, or directly explore the Rimbu MultiMap API Docs.
Experience @rimbu/multimap
in action! Try Out Rimbu on CodeSandBox.
Yarn:
yarn add @rimbu/multimap
npm:
npm install @rimbu/multimap
Bun:
bun add @rimbu/multimap
For Deno, the following approach is recommended:
In the root folder of your project, create or edit a file called import_map.json
with the following contents (where you should replace x.y.z
with the desired version of Rimbu):
{
"imports": {
"@rimbu/": "https://deno.land/x/rimbu@x.y.z/"
}
}
Note: The trailing slashes are important!
In this way you can use relative imports from Rimbu in your code, like so:
import { List } from '@rimbu/core/mod.ts';
import { HashMap } from '@rimbu/hashed/mod.ts';
Note that for sub-packages, due to conversion limitations it is needed to import the index.ts
instead of mod.ts
, like so:
import { HashMap } from '@rimbu/hashed/map/index.ts';
To run your script (let's assume the entry point is in src/main.ts
):
deno run --import-map import_map.json src/main.ts
import { HashMultiMapHashValue } from '@rimbu/multimap';
console.log(HashMultiMapHashValue.of([1, 2], [1, 3], [2, 3]).toString());
Created and maintained by Arvid Nicolaas.
We welcome contributions! Please read our Contributing guide.
Made with contributors-img.
This project is licensed under the MIT License. See the LICENSE for details.