title: What does map.put return?
body: <p>I tried to get the return type of put method of the map interface. When I print for the first time it is printing null and after updating the key I get the previous value.
  So, can anyone tell me what is the return type of the put method in the map interface?</p>
  
  <pre><code>Map&lt;Integer, String&gt; map = new HashMap&lt;Integer, String&gt;();
  System.out.println(map.put(1, "ABC"));
  System.out.println(map.put(1, "XYZ"));
  
  Output:
  null
  ABC
  </code></pre>