Liking cljdoc? Tell your friends :D

ham-fisted.mut-map

Functions for working with java's mutable map interface

Functions for working with java's mutable map interface
raw docstring

compute!clj

(compute! m k bfn)

Compute a new value in a map derived from an existing value. bfn gets passed k, v where k may be nil. If the function returns nil the corresponding key is removed from the map.

See Map.compute

An example bfn for counting occurrences would be #(if % (inc (long %)) 1).

Compute a new value in a map derived from an existing value.  bfn gets passed k, v where k
may be nil.  If the function returns nil the corresponding key is removed from the map.

See [Map.compute](https://docs.oracle.com/javase/8/docs/api/java/util/Map.html#compute-K-java.util.function.BiFunction-)

An example `bfn` for counting occurrences would be `#(if % (inc (long %)) 1)`.
raw docstring

compute-if-absent!clj

(compute-if-absent! m k bfn)

Compute a value if absent from the map. Useful for memoize-type operations. Must use mutable maps. bfn gets passed k.

See map.computeIfAbsent

Compute a value if absent from the map.  Useful for memoize-type operations.  Must use
mutable maps.  bfn gets passed k.

See [map.computeIfAbsent](https://docs.oracle.com/javase/8/docs/api/java/util/Map.html#computeIfAbsent-K-java.util.function.Function-)
raw docstring

compute-if-present!clj

(compute-if-present! m k bfn)

Compute a new value if the value already exists and is non-nil in the hashmap. Must use mutable maps. bfn gets passed k, v where v is non-nil.

See Map.computeIfPresent

Compute a new value if the value already exists and is non-nil in the hashmap.  Must use
mutable maps.  bfn gets passed k, v where v is non-nil.

See [Map.computeIfPresent](https://docs.oracle.com/javase/8/docs/api/java/util/Map.html#computeIfPresent-K-java.util.function.BiFunction-)
raw docstring

keysetclj

(keyset m)

Return the keyset of the map. This may not be in the same order as (keys m) or (vals m). For hamf maps, this has the same ordering as (keys m). For both hamf and java hashmaps, the returned implementation of java.util.Set has both more utility and better performance than (keys m).

Return the keyset of the map.  This may not be in the same order as (keys m) or (vals
m).  For hamf maps, this has the same ordering as (keys m).  For both hamf and java
hashmaps, the returned implementation of java.util.Set has both more utility and better
performance than (keys m).
raw docstring

valuesclj

(values m)

Return the values collection of the map. This may not be in the same order as (keys m) or (vals m). For hamf hashmaps, this does have the same order as (vals m).

Return the values collection of the map.  This may not be in the same order as (keys m)
or (vals m).  For hamf hashmaps, this does have the same order as (vals m).
raw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close