title: Difference between replace and put for HashMap
body: <p>I want to make a histogram by using a <code>HashMap</code>, the key should be the delay, the value the amount of times this delay occurs. I am doubting to use the <code>HashMap</code> <code>replace</code> or the <code>HashMap</code> <code>put</code> function if an already existing delay has an new occurence. I did it by this way:</p>
  <pre><code>int delay = (int) (loopcount-packetServed.getArrivalTime());
  if(histogramType1.containsKey(delay)) {
      histogramType1.replace(delay, histogramType1.get(delay) + 1);   
  } else {
      histogramType1.put(delay, 1);
  }
  </code></pre>
  <p>Is this correct? or should I use two times the put function?</p>