...
This guideline applies to all uses of Collection
classes including the thread-safe Hashtable
class. Enumerations of the objects of a Collection
and iterators also require explicit synchronization on the Collection
object or any single lock object.
Some primitive operators may also not be atomic; see CON01-J. Do not assume all primitive operators are atomic for more information.
Noncompliant Code Example (AtomicReference
)
...