title: Java ConcurrentHashSet - iterating over it in a multi-threaded environment
body: <p>I've seen the use cases of SynchronizedList - they state that upon iterating, even though SynchronizedList is thread-safe, we should use an iterator and a synchronized block like so - </p>
  
  <pre><code>    synchronized(myList){
      Iterator&lt;Item&gt; iterator = myList.iterator();
      while (iterator.hasNext())
      {
          System.out.println(iterator.next().getMessage());
      }
      }
  </code></pre>
  
  <p>If I use a ConcurrentHashSet for example (possible in Java 8 using newKeySet() of concurrentHashMap), in a multi-threaded environment, is it still necessary to extract an iterator and use a synchronized block? I tried testing it and it seems unnecessary but I might be missing something.</p>
  
  <p>Thank you!</p>