I have a list of highscores, and I would like to group it into lists for each category the highscores belong to.
My data classes look like this
data class HighScore(val word: Word)
data class Word(val category: String)
I was doing something like this.
val highScores = listOf<HighScore>(...)
val groupedScores = highScores.groupBy{ it:HighScore
it.word.category
}
What I am trying to do is to get all the high-scores with a similar category and put them into separate lists, I am sure there must be a function for that in kotlin, but I only seem to be able to find tutorials that explains how to group lists by number values and not predicates.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…