title: Kotlin convert Map<Key, Value> to Map<key, List<Value>>
body: <p>Is there any way to create Map of ?
  Below I'm showing what I got for now. First solution is much cleaner but requires to get another object what I don't need (functional programming).</p>
  
  <pre><code>    val result: MutableMap&lt;key, MutableList&lt;Int&gt;&gt; = mutableMapOf()
  
      someArray.onEach { (key, int) -&gt;
          result
              .computeIfAbsent(key.id) { mutableListOf() }
              .add(int)
      }
  
      return list
  </code></pre>
  
  <p>I got something like this which is not so clean</p>
  
  <pre><code>    return someArray
          .map { (key, int) -&gt;
              key.id to int
          }
          .groupBy { it.first }
          .map { (k, v) -&gt;
              k to v.filter { it.first == k }
                  .map { it.second }
          }
  </code></pre>