title: Kotlin - list of elements where some have the same ID, needs to be grouped
body: <p>I've got a list of, let's say food dishes.
  The data class looks like this:</p>
  
  <pre><code>data class FoodItem(val categoryId: Int, val categoryTitle: String, val title: String, val text: String)
  </code></pre>
  
  <p>So let's say I have this is as data:</p>
  
  <pre><code>val list = listOf(FoodItem(1, "Mexican", "Burrito", "Wrapped food"),
              FoodItem(2, "Italian", "Pizza", "Dough, cheese and tomato"),
              FoodItem(3, "BBQ", "Brisket", "Does it need explaining?"),
              FoodItem(4, "Japanese", "Sushi", "Raw fish and rice!"),
              FoodItem(2, "Italian", "Pasta", "Great with meatballs!"))
  </code></pre>
  
  <p>I want this to be grouped into a single list, where the ones where CategoryId and CategoryTitle match, are grouped.</p>
  
  <p>So in the end I would like a list of 4 items, where the Italian category has 2 items in its own list. So I would imagine I need a new data class that can hold a Category, which contains the id and title, and then a list of FoodDescription or something that contains Pizza, Pasta, etc etc, all within the category it's in. </p>
  
  <p>I would like an output something similar to this:</p>
  
  <pre><code>GroupedFoodItemViewModel(category=Category(categoryId=2, categoryTitle=Italian), foods=[FoodItemViewModel(categoryId=2, categoryTitle="Italian", foodTitle="Pasta", foodText="Great with meatballs!"), FoodItemViewModel(categoryId=2, categoryTitle=Italian, foodTitle=Pizza, foodText=Dough, cheese and tomato)])
  </code></pre>
  
  <p>Where the rest would be in a list similar to this, just with one element under the "foods" array. I'd like to use this in a recyclerview, where I have the category as a title and the list of foods in below the category.</p>