title: (Java) Why is a HashSet allowed to be used synchronously if it is non synchronized?
body: <p>I've been reading up on the differences between a <code>HashMap</code>, <code>HashSet</code>, and <code>HashTable</code>. A key thing I've been noticing is that I've seen that <code>HashMap</code>/<code>HashSet</code> are not synchronized while a <code>HashTable</code> is. </p>
  
  <p>However in a code base that I've seen before there are several places where a block like this is used: </p>
  
  <pre><code>synchronized (hashSet) {
      //Some code involving the hashset 
  }
  </code></pre>
  
  <p>How is this possible if a <code>HashSet</code> isn't synchronized? Does the synchronized block simply allow us to use a non synchronous data structure as if it were synchronized? </p>
  
  <p>If <code>HashSet</code> were synchronized would we just not have to include the synchronized() {} block? </p>