# Utils.Multimap¶

This document is auto-generated for Owl’s APIs. #12 entries have been extracted.

Github: {Signature} {Implementation}

## Type definition¶

type key = Ord.t


Type of the multimap keys.

type 'a t


Type of a multimap.

## Basic functions¶

val empty : 'a t


The empty multimap.

source code

val is_empty : 'a t -> bool


Check whether the multimap is empty.

source code

val mem : key -> 'a t -> bool

mem k m returns true is the multimap m contains at least one binding
for k, false otherwise.

source code

val add : key -> 'a -> 'a t -> 'a t

add k v m returns a multimap containing the same bindings as m, plus a
binding from k to v. Previous bindings for k are hidden by the new binding (they can be restored by calling remove k m).

source code

val remove : key -> 'a t -> 'a t

remove k v m returns a multimap with the same bindings as m, except
for the binding of k: the last value that was bound to it is removed. If there is no binding for k in m, raises Not_found.

source code

val find : key -> 'a t -> 'a

find k m returns the last added binding of k in m, or raises
Not_found if there is no such binding.

source code

val max_binding : 'a t -> key * 'a

max_binding m returns the greatest binding in m. Raises Not_found
if m is empty.

source code

val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_first_opt f m returns the first binding (k, v) such that f k,
or None if no such binding exists. The function f has to be nondecreasing. Time complexity is O(log n).

source code