title: How do I get the latest view of a ConcurrentHashMap?
body: <p>You can ensure that changes one thread makes to a variable can be seen on other threads by making the variable volatile, or by having both threads synchronize on something. If the thing being changed is a java.util.ConcurrentHashMap, does it make sense to create a memory barrier by declaring the type of the variable holding this map as volatile, or are readers accessing the map (say via <code>myMap.values()</code>) going to get the latest possible view anyway? For context I have a heavy reading, light writing scenario where I am switching my <a href="https://stackoverflow.com/questions/11963972">lock free read solution</a> to a ConcurrentHashMap.</p>