Skip to content

Instantly share code, notes, and snippets.

@rnaufal
Created February 26, 2018 14:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rnaufal/8a7a47868921d6d8a268df92838ef73e to your computer and use it in GitHub Desktop.
Save rnaufal/8a7a47868921d6d8a268df92838ef73e to your computer and use it in GitHub Desktop.
data class Employee(val name: String, val department: String)
val mark = Employee("Mark", "Accounting")
val john = Employee("John", "Management")
val smith = Employee("Smith", "Administrative")
val paul = Employee("Paul", "Accounting")
val employees = listOf(mark, john, smith, paul)
val employeesByDepartment = employees.groupBy { it.department }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment