Module CCMultiMap.Make

Parameters

V : OrderedTypeK : OrderedType

Signature

type key = K.t
type value = V.t
type t
val empty : t

Empty multimap.

val is_empty : t -> bool

Empty multimap?

val add : t -> key -> value -> t

Add a key/value binding.

val remove : t -> key -> value -> t

Remove the binding.

val remove_all : t -> key -> t

Remove the key from the map.

val mem : t -> key -> bool

Is there a binding for this key?

val find : t -> key -> value list

List of values for this key.

val find_iter : t -> key -> (value -> unit) -> unit

Iterate on bindings for this key.

val count : t -> key -> int

Number of bindings for this key.

val iter : t -> (key -> value -> unit) -> unit

Iterate on all key/value.

val fold : t -> 'a -> ('a -> key -> value -> 'a) -> 'a

Fold on all key/value.

val size : t -> int

Number of keys.

val union : t -> t -> t

Union of multimaps.

val inter : t -> t -> t

Intersection of multimaps.

val diff : t -> t -> t

Difference of maps, i.e. bindings of the first that are not in the second.

val equal : t -> t -> bool

Same multimap.

val compare : t -> t -> int

Total order on multimaps.

val submap : t -> t -> bool

submap m1 m2 is true iff all bindings of m1 are also in m2.

val to_seq : t -> (key * value) sequence
val of_seq : ?⁠init:t -> (key * value) sequence -> t
val keys : t -> key sequence
val values : t -> value sequence

Some values may occur several times.