title: A Groovy way to add element to a list in a map?
body: <p>I have a <code>Map</code> of <code>Int-&gt;List[Int]</code>, and given a value I want to check if it already has an entry. If so, add to the list. Otherwise, create a new list and add to it. Is there a shorter way to do this?</p>
  
  <pre><code>def map = [:]
  
  (1..100).each { i -&gt;
      if (map[i % 10] == null) {
          map[i % 10] = []
      }
      map[i % 10].add(i)
  }
  </code></pre>