Skip to content

Latest commit

 

History

History
42 lines (30 loc) · 941 Bytes

multi-map.md

File metadata and controls

42 lines (30 loc) · 941 Bytes
name usage names inherits methods
MultiMap
var MultiMap = require("collections/multi-map");
MultiMap()
MultiMap(values)
MultiMap(values, bucket)
MultiMap(values, bucket, equals, hash)
map
set
bucket
construct-clone
content-equals
content-hash

A map from keys to buckets, typically arrays.

--- |

A MultiMap is a thin layer on a Map. The getDefault and set methods are overriden to ensure that there will always be a single bucket value intrinsic to each key, always returned by get and only modified by set.

The optional bucket argument overrides the MultiMap’s default bucket(key) method, which creates a new bucket for a given key. By default, this method just returns an empty array.

The optional equals and hash arguments override the contentEquals and contentHash methods, which operate on keys of the map to find where to store entries.