|
Module MMapThis module is undocumented. This is a list of its definitions. clear :: MMap.T a b -> <Proc> () Removes all entries from the map. clone :: MMap.T a b -> <Proc> MMap.T a b Creates a new map with the same entries as the given map. The copy is shallow: the new map is independent, so adding or removing entries in one does not affect the other, but the keys and values themselves are shared. Mutating a value reached through one map is visible through the other. Example:
containsKey :: MMap.T a b -> a -> <Proc> Boolean Returns containsValue :: MMap.T a b -> b -> <Proc> Boolean Returns create :: () -> <Proc> MMap.T a b Creates a new empty map. createC :: Integer -> <Proc> MMap.T a b Creates a new empty map with room for the given number of entries. entries :: MMap.T a b -> <Proc> [(a, b)] The entries of the map as a list of key-value pairs. Unlike the entrySet :: MMap.T a b -> <Proc> MSet.T (Entry a b) A set view of the entries of the map. This is a live view, not a copy:
changes to the map are reflected in the view, and removing entries from the
view removes them from the map. Use The entries are opaque; read them with Example:
fold :: (a -> b -> c -> <d> a) -> a -> MMap.T b c -> <Proc,d> a Folds over all key-value pairs of the map starting with the given initial value. fromEntryList :: [(a, b)] -> <Proc> MMap.T a b Creates a new map from the given list of key-value pairs. get :: MMap.T a b -> a -> <Proc> Maybe b The value associated with the given key, or getOrCreate :: MMap.T a b -> (a -> <c> b) -> a -> <Proc,c> b
Note the argument order: the creating function sits between the map and the key.
Note also that the created value is stored in the map, not just returned, so a
later call with the same key returns the cached value without calling Example:
isEmpty :: MMap.T a b -> <Proc> Boolean Returns iter :: (a -> b -> <c> ()) -> MMap.T a b -> <c,Proc> () Calls the given function with all key-value pairs of the map. iterB :: (a -> b -> <c> Boolean) -> MMap.T a b -> <c,Proc> Boolean Calls the given function with the key-value pairs of the map until it returns
The result therefore means "was not interrupted", not "found something": it is
Example:
keyOf :: Entry a b -> a The key of the entry. Entries can only be obtained from keySet :: MMap.T a b -> MSet.T a A set view of the keys of the map. Obtaining the view reads nothing, which is
why this is the only declaration in this module without The view is live, not a copy: changes to the map are reflected in the view,
and removing a key from the view removes the whole entry from the map. Use
Example:
keys :: MMap.T a b -> <Proc> [a] The keys of the map as a list. Unlike the The map is hash-based, so the order of the returned list is not a contract.
Example:
map :: (a -> <c> b) -> MMap.T d a -> <Proc,c> MMap.T d b Creates a new map with the same keys as the given map and the values mapped with the given function. Only the values are mapped; the keys are carried over unchanged. The result is a new mutable map, independent of the original. Example:
put :: MMap.T a b -> a -> b -> <Proc> Maybe b
The return value is rarely wanted, so call sites almost always discard it
with Example:
putM :: (a -> a -> a) -> MMap.T b a -> b -> a -> <Proc> ()
Mind the argument order of Example:
remove :: MMap.T a b -> a -> <Proc> Maybe b Removes the given key from the map and returns the value that was associated
with it, or Example:
size :: MMap.T a b -> <Proc> Integer The number of entries in the map. unsafeGet :: MMap.T a b -> a -> <Proc> b Like If the map contains no such key, the result is a raw Java valueOf :: Entry a b -> b The value of the entry. Entries can only be obtained from values :: MMap.T a b -> <Proc> [b] The values of the map as a list. A snapshot, not a view; see |