https://kotlinlang.org logo
Title
n

Nick

05/29/2022, 7:19 PM
I’d like to create a scheduler app that contains a list of events. Each event has a
startDate
and an
endDate
. I’d like to determine which events overlap so I can place events in a different column. Is there a way to apply some sort of
groupBy
function to accomplish a way for me to group them?
p

phldavies

05/29/2022, 8:51 PM
if your events are sorted by start date, you can
fold
into a list of lists, appending the event to the current list while the event's start date is less than the latest endDate of the current list
👍 1
n

Nick

05/29/2022, 10:03 PM
Oh good idea! Thanks b