Concurrent Maps | Contents |
A concurrent map can be accessed by several threads at once. In addition to the usual Map operations, it provides the following atomic operations:
Operations in class ConcurrentMap | |
What it is | What it does |
m putIfAbsent(k, v) | Adds key/value binding k -> m unless k is already defined in m |
m remove (k, v) | Removes entry for k if it is currently mapped to v. |
m replace (k, old, new) | Replaces value associated with key k to new, if it was previously bound to old. |
m replace (k, v) | Replaces value associated with key k to v, if it was previously bound to some value. |
ConcurrentMap is a trait in the Scala collections library. Currently, its only implementation is Java's java.util.concurrent.ConcurrentMap, which can be converted automatically into a Scala map using the standard Java/Scala collection conversions
Next: Mutable Bitsets
Concurrent Maps | Contents |