title: Safe publication of java.util.concurrent collections
body: <p>Is volatile redundant in this code?</p>
  
  <pre><code>public class Test {
      private volatile Map&lt;String, String&gt; map = null;
  
      public void resetMap() { map = new ConcurrentHashMap&lt;&gt;(); }
  
      public Map&lt;String, String&gt; getMap() { return map; }
  }
  </code></pre>
  
  <p>In other words, does <code>map = new ConcurrentHashMap&lt;&gt;();</code> provide any visibility guarantees?</p>
  
  <p>As far as I can see, the only guarantee provided by <a href="http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/ConcurrentMap.html" rel="noreferrer"><code>ConcurrentMap</code></a> is:</p>
  
  <blockquote>
    <p>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.</p>
  </blockquote>
  
  <p>How about other thread safe collections in java.util.concurrent (CopyOnWriteArrayList, etc.)?</p>