It's working! If anyone's interested: ``` val mome...
# stdlib
r
It's working! If anyone's interested:
Copy code
val moments: List<ListItem> = moments
        .groupBy { it.timePosted!!.toLocalDate().withDayOfMonth(1) }
        .map { it.key to it.value.map { ListItem.MomentItem(it) } }
        .flatMap { listOf(ListItem.HeaderItem(it.first)) + it.second }
Now to clean this up quite a bit, lots of stuff in there I still don't like 😄