title: HashMap and garbage collection: do I need to call clear() before variable re-assignment?
body: <p>Maybe it's a silly question but I'm not sure about the garbage collection process.</p>
  
  <p>Consider this code:</p>
  
  <pre><code>private HashMap&lt;String, Parameter&gt; configuration = new HashMap&lt;String, Parameter&gt;();
  
  ...
  //add some items to configuration
  ...
  
  //now get another configuration
  HashMap&lt;String, Parameter&gt; parameters = new HashMap&lt;String, Parameter&gt;();
  for (String parameterName : configurationParameterNameList) {
      parameters.put(parameterName, reader.readParameter(parameterName));
  }
  
  //and reassign the variable
  this.configuration.clear();
  this.configuration = parameters;
  </code></pre>
  
  <p>Do I need to call <code>configuration.clear()</code> before reassign it? <code>Parameter</code> class contains only a few String variables inside.</p>