title: How to make a Map with default values if key is not present?
body: <p>I want to build a map of array parsing a list of object.
  When a index of that map as already been added, i need to add the elements of the array that were not added before, else i need to create the new element in the Map.</p>
  
  <p>Let's say we have a csv with data like this</p>
  
  <pre><code>names,nicknames
  Tom,tommy;timmy
  Sam,sammy
  Tom,timmy;mymen
  </code></pre>
  
  <p>And i want a map like this :</p>
  
  <pre><code>Map["Tom"] = ["tommy", "timmy", "mymen"]
  Map["Sam"] = ["sammy"]
  </code></pre>
  
  <p>I'm quite surprised that there is no native function for that</p>
  
  <p>What's working, but should be improved ? (i have a 400k lines CSV to parse)</p>
  
  <pre><code>    val myObjectList: List&lt;myObject&gt; = beans.parse() /* importing POJOs from csv*/
      val myMap: MutableMap&lt;String,List&lt;String&gt;&gt; = mutableMapOf()
  
      myObjectList.forEach { entry -&gt;
         if ( myMap[entry.name].isNullOrEmpty()) {
             myMap[entry.name] = entry.nicknames.split(";")
         } else {
             myMap[entry.name]!!.plus(entry.nicknames.split(";"))
         }
      }
  
  
      return myMap
  </code></pre>