Tim Malseed
04/15/2021, 12:34 AMCollections.groupBy
that allows you to specify a grouping function?
I have a list of Songs. I’d like to group them together, using the following logic (psuedo-code)
val group = if (album name matches) {
if (artist name matches) {
true
} else {
if (album-artist name matches) {
true
}
}
false
}
Tim Malseed
04/15/2021, 12:39 AMnkiesel
04/15/2021, 1:02 AMnkiesel
04/15/2021, 1:03 AMpartition
would helpephemient
04/15/2021, 2:19 AMTim Malseed
04/15/2021, 2:19 AMephemient
04/15/2021, 2:20 AMTim Malseed
04/15/2021, 2:23 AMTim Malseed
04/15/2021, 2:26 AMTim Malseed
04/15/2021, 2:27 AMephemient
04/15/2021, 2:29 AMephemient
04/15/2021, 2:30 AMTim Malseed
04/15/2021, 2:31 AMTim Malseed
04/15/2021, 2:32 AMephemient
04/15/2021, 2:33 AMephemient
04/15/2021, 2:34 AMTim Malseed
04/15/2021, 2:39 AMTim Malseed
04/15/2021, 2:41 AMephemient
04/15/2021, 2:41 AMephemient
04/15/2021, 2:41 AMephemient
04/15/2021, 2:42 AMTim Malseed
04/15/2021, 2:42 AMephemient
04/15/2021, 2:42 AMephemient
04/15/2021, 2:43 AMTim Malseed
04/15/2021, 2:43 AMIf the album-artist of a song is null, then the artist name is used
Tim Malseed
04/15/2021, 2:43 AMephemient
04/15/2021, 2:44 AMTim Malseed
04/15/2021, 2:45 AMephemient
04/15/2021, 2:45 AMTim Malseed
04/15/2021, 2:46 AMephemient
04/15/2021, 2:46 AMTim Malseed
04/15/2021, 2:46 AMTim Malseed
04/15/2021, 2:47 AMTim Malseed
04/15/2021, 2:47 AMP→Q does not imply ¬P→¬QWhat is this notation, by the way?
ephemient
04/15/2021, 2:48 AMTim Malseed
04/15/2021, 2:48 AMTim Malseed
04/15/2021, 2:52 AMdata class GroupKey(val album: String, val albumArtistOrArtist: String)
And then songs.groupBy { GroupKey(it.album, it.albumArtist ?: it.artist) }
Tim Malseed
04/15/2021, 3:03 AMMatteo Mirk
04/15/2021, 7:21 AMTim Malseed
04/15/2021, 12:29 PMStephan Schroeder
04/16/2021, 2:53 PMMatteo Mirk
04/19/2021, 8:15 AMTim Malseed
04/19/2021, 8:44 AMgroupBy()
to work, and must correctly distinguish two instances of this class by its parameters