Kotlin grouping multiple fields

We will share with you in this article,How to perform grouping function on list using multiple fields.

 

data class Person(val id: Int, val name: String)

val grp = list.groupBy { Person(it.id, it.name) }

I hope it will help you.. 

Tags: