Skip to content

Instantly share code, notes, and snippets.

@AravinthVelusamy
Last active May 17, 2020 16:05
Show Gist options
  • Select an option

  • Save AravinthVelusamy/bf7c0a96d4568df732fb7735b0dae9a2 to your computer and use it in GitHub Desktop.

Select an option

Save AravinthVelusamy/bf7c0a96d4568df732fb7735b0dae9a2 to your computer and use it in GitHub Desktop.
/**
* Find the first league of each set and return pairs of
* index to league name. Assumes that clubs are sorted by ascending league name.
*/
fun indexAgendaHeaders(agendaItems: List<ClubEntity>): List<Pair<Int, String>> {
return agendaItems
.mapIndexed { index, block -> index to block.clubLeague }
.distinctBy { it.second }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment