title: Groovy - How to get map value with default without updating the map
body: <p>How to read value for the given key from a map, with providing a default value (used if the map doesn't contain entry for the specified key),
  but without updating the map - this is what <code>get</code> method does:</p>
  
  <blockquote>
    <p><code>get(Object key, Object defaultValue)</code></p>
    
    <p>Looks up an item in a Map for the given key and returns the value - unless there is no entry for the
    given key <strong><em>in which case add the default value to the map</em></strong> and return
    that.</p>
  </blockquote>
  
  <ol>
  <li>Ofc it must be a single, short expression  </li>
  <li>For performance reasons, creating a deepcopy on that map (so it could be updated) and using mentioned <code>get</code> is not a solution.</li>
  </ol>
  
  <p>Equivalents in different languages:</p>
  
  <ul>
  <li><em>JavaScript</em>: <code>map["someKey"] || "defaultValue"</code></li>
  <li><em>Scala</em>: <code>map.getOrElse("someKey", "defaultValue")</code></li>
  <li><em>Python3</em>: <code>map.get("someKey", "defaultValue")</code></li>
  </ul>