<K, V> Map<K, V> java.util.Collections.synchronizedMap(Map<K, V> m)
Returns a synchronized (thread safe) card supported by the specified card. In order to guarantee consistent access, it is imperative that all access to the support card is through the returned card.
It is imperative that the user manually synchronizes on the returned map when repeating any of their collection views:
Map m = Collections.synchronizedMap(new HashMap()); ... Set s = m.keySet();
Failure to comply with this advice may result in non-deterministic behavior.
The returned map will be serialized if the specified map is serializable.
Parameters: m card must be "wrapped" in a synchronized card. Returns: synchronized view of the specified map.
source share