Created
March 24, 2022 00:07
-
-
Save matthewrkula/dd350b454710d1d377ea610a7f444f19 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data class Grouping( | |
val groups: List<Group>, | |
) | |
data class Group( | |
val standings: List<Standings>, | |
) | |
data class Standings( | |
val team: Team, | |
) | |
data class Team( | |
val id: String | |
) | |
fun main() { | |
val selectedIndex = groupings.indexOfFirst { grouping -> | |
grouping.groups.any { group -> | |
group.standings.any { | |
it.team.id == "4" | |
} | |
} | |
} | |
println(selectedIndex) | |
} | |
val groupings = listOf( | |
Grouping( | |
listOf(Group( | |
listOf( | |
Standings(Team(id = "1")), | |
Standings(Team(id = "2")), | |
)) | |
) | |
), | |
Grouping( | |
listOf(Group( | |
listOf( | |
Standings(Team(id = "3")), | |
Standings(Team(id = "4")), | |
)) | |
) | |
), | |
Grouping( | |
listOf(Group( | |
listOf( | |
Standings(Team(id = "5")), | |
Standings(Team(id = "6")), | |
)) | |
) | |
), | |
Grouping( | |
listOf(Group( | |
listOf( | |
Standings(Team(id = "7")), | |
Standings(Team(id = "8")), | |
)) | |
) | |
), | |
) | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment