...
Code Block | ||
---|---|---|
| ||
public class Container<K,V> { volatile Map<K,V> map; // ... } |
This also applies to Similarly, declaring immutable sub-objects by enabling as volatile
enables their safe publication, in that, once published, it is impossible to change the state of the sub-object.
...