title: Is there any reason to use a synchronized HashMap rather than ConcurrentHashMap?
body: <p>In a multi-threaded application, is there any scenario in which it is better to use a HashMap with synchronization when needed, than to use a ConcurrentHashMap?</p>
  
  <p>Specifically, I am thinking of an application where the map is initialized like this:</p>
  
  <pre><code>Map&lt;String,String&gt; map = new HashMap&lt;&gt;();
  </code></pre>
  
  <p>Each thread accesses the map only to update it and immediately convert it to string, so the only synchronized block is:</p>
  
  <pre><code>synchronized(map) {
      map.put(key,value);
      StringBuilder sb = new StringBuilder();
      for (String k: map.keySet())
          sb.append("("+k+","+map.get(k)+")");
  }
  </code></pre>
  
  <p>In this case, will it be safer to change the initialization to:</p>
  
  <pre><code>Map&lt;String,String&gt; map = new ConcurrentHashMap&lt;&gt;();
  </code></pre>
  
  <p>and drop the "synchronized"?</p>