Grouping list by object except one field
I have to group list items if the items fields are the same. Above in my code, it works what I want if every id is the same. But product ids are unique. For that reason, I cant make the right grouping.
I want to make grouping by item except for id.
data class Product(
val id: Int,
val name: String,
val price: Int,
val quantity: Int
)
data class GroupedProduct(
val product: Product,
val count: Int,
val totalQuantity: Int,
val isGroup: Boolean
)
var products =...