title: Map getOrDefault VS getOrUseSupplier
body: <p>I am starting to learn lambdas and i do not understand why java Map has:</p>
  
  <pre><code>getOrDefault(Object key, V defaultValue)
  </code></pre>
  
  <p>and not(working just the same, but if value is absent, then defaultValue will be taken from supplier):</p>
  
  <pre><code>getOrUseSupplier(Object key, Supplier&lt;V&gt; defaultValue)
  </code></pre>
  
  <p>Adventages i currently see of current solution:</p>
  
  <ul>
  <li>defaultValue does not have to be a final/effectively final value</li>
  <li>looks simpler &amp; no need to know lambda syntax</li>
  </ul>
  
  <p>Disadventages:</p>
  
  <ul>
  <li>If while using getOrDefault we put new object creation, it will be created and passed to GC immidietely(while using supplier, it will not be created at all).</li>
  </ul>
  
  <p>I would like to know if there is any more disadventages of using &amp; having getOrDefault rather than getOrUseSupplier. Could you also tell me if anywhere in java libraries, there is method like this:</p>
  
  <pre><code>static &lt;V&gt; V getOrUseSupplier(Map&lt;?, V&gt; map, Object key, Supplier&lt;V&gt; supplier)
  </code></pre>
  
  <p>that tries to take Value from map, and if it does not exist then takes value from Supplier.</p>