title: How to group objects by values
body: <p>I have an object that looks like this:</p>
  
  <pre><code>data class Product(val name: String,
                     val maker: List&lt;String&gt;)
  </code></pre>
  
  <p>Currently, the response that I receive from the backend (and it can't be changed) is as follows:</p>
  
  <pre><code>[{"name":"Car", "maker":["Audi"]},
   {"name":"Car", "maker":["BMW"]},
   {"name":"Motorcycle", "maker":["Yamaha"]},
   {"name":"Motorcycle", "maker":["Kawasaki"]}
  ]
  </code></pre>
  
  <p>The actual list consists of a lot of data, but the <code>name</code> field can be trusted to be grouped by.
  What would be a way for me to map this data so that the end result is something like this:</p>
  
  <pre><code>[{"name":"Car", "maker":["Audi", "BMW"]},
   {"name":"Motorcycle", "maker":["Yamaha","Kawasaki"]}
  ]
  </code></pre>