77[ ![ License] ( https://img.shields.io/badge/License-MIT-blue.svg )] ( https://opensource.org/licenses/MIT )
88[ ![ Last Updated] ( https://img.shields.io/github/last-commit/mkaput/elixir-bimap.svg )] ( https://github.com/mkaput/elixir-bimap/commits/master )
99
10- Elixir implementation of bidirectional map and multimap.
10+ Elixir implementation of bidirectional map ( ` BiMap ` ) and multimap ( ` BiMultiMap ` ) .
1111
1212## Installation
1313
@@ -19,6 +19,40 @@ def deps do
1919end
2020```
2121
22+ ## Getting started
23+
24+ For more examples, checkout [ ` BiMap ` ] ( https://hexdocs.pm/bimap/BiMap.html ) and [ ` BiMultiMap ` ] ( https://hexdocs.pm/bimap/BiMultiMap.html ) on hex docs.
25+
26+ ### BiMap
27+
28+ ``` elixir
29+ iex (1 )> Mix .install [:bimap ]
30+ iex (2 )> bm = BiMap .new (a: 1 , b: 2 )
31+ # BiMap<[a: 1, b: 2]>
32+ iex (3 )> BiMap .get (bm, :a )
33+ 1
34+ iex (4 )> BiMap .get_key (bm, 2 )
35+ :b
36+ iex (5 )> BiMap .put (bm, :a , 3 )
37+ # BiMap<[a: 3, b: 2]>
38+ iex (6 )> BiMap .put (bm, :c , 2 )
39+ # BiMap<[a: 1, c: 2]>
40+ ```
41+
42+ ### BiMultiMap
43+
44+ ``` elixir
45+ iex (1 )> Mix .install [:bimap ]
46+ iex (2 )> mm = BiMultiMap .new (a: 1 , b: 2 , b: 1 )
47+ # BiMultiMap<[a: 1, b: 1, b: 2]>
48+ iex (3 )> BiMultiMap .get (mm, :a )
49+ [1 ]
50+ iex (4 )> BiMultiMap .get_keys (mm, 1 )
51+ [:a , :b ]
52+ iex (5 )> BiMultiMap .put (mm, :a , 3 )
53+ # BiMultiMap<[a: 1, a: 3, b: 1, b: 2]>
54+ ```
55+
2256## License
2357
2458See the [ LICENSE] file for license rights and limitations (MIT).
0 commit comments