How to get the list of values that belong to a group after groupBy operation in Kotlin?
I have the following data:
import kotlin.test.*
import java.util.*
data class Sales(val year: Int, val price: Int)
val myList = listOf(
Sales(2017, 10),
Sales(2017, 19),
Sales(2020, 15),
Sales(2021, 100),
Sales(2020, 20),
)
I want to see how to get the list of values for each group. For example, I want the result as
{2017=[10, 19], 2020=[15, 20], 2021=[100]}