title: HashMap: safe for multithreaded access for multiple readers and one single writer?
body: <p>I'm reading the docs for <a href="http://docs.oracle.com/javase/7/docs/api/java/util/HashMap.html" rel="nofollow"><code>java.util.HashMap</code></a>, and it says:</p>
  
  <blockquote>
    <p>If multiple threads access this map concurrently, and at least one of
    the threads modifies the map structurally, it must be synchronized
    externally.</p>
  </blockquote>
  
  <p><strong>What does "it" mean?</strong> "it" could be interpreted to mean the thread that modifies the map, or it could mean the map itself.</p>
  
  <p>Both the "safe for multiple threads reading" and "safe only on single thread when there is a writer" cases are no brainers (at least to me), which makes me believe that calling the "multiple readers and single writer" case speciffically in the documentation means the statement should be interpreted as "safe to have multiple threads reading and a single thread writing", rather than the no brainer "lock everything when you have a writer".</p>
  
  <p>More so, the hashtable implementation in .Net is (unambiguously) documented as:</p>
  
  <blockquote>
    <p>Hashtable is thread safe for use by multiple reader threads and a single writing thread</p>
  </blockquote>
  
  <p>(the .Net classes are not thread safe by default), so there must be something to the "multiple reader threads and one single writer thread" case.</p>