Module java.base

Interface ConcurrentMap<K,V>

Type Parameters:
K - the type of keys maintained by this map
V - the type of mapped values
All Superinterfaces:
All Known Subinterfaces:
All Known Implementing Classes:
ConcurrentHashMap, ConcurrentSkipListMap

public interface ConcurrentMap<K,V> extends Map<K,V>
A Map providing thread safety and atomicity guarantees.

To maintain the specified guarantees, default implementations of methods including putIfAbsent(K, V) inherited from Map must be overridden by implementations of this interface. Similarly, implementations of the collections returned by methods Map.keySet(), Map.values(), and Map.entrySet() must override methods such as removeIf when necessary to preserve atomicity guarantees.

Memory consistency effects: As with other concurrent collections, actions in a thread prior to placing an object into a ConcurrentMap as a key or value happen-before actions subsequent to the access or removal of that object from the ConcurrentMap in another thread.

This interface is a member of the Java Collections Framework.