Colton Idle
04/13/2023, 1:49 PMmyScreenState.listOf20Items.flatMap { it.subListOf10Items }.flatMap { it.anotherSubListOf10Items }
.filter { it.isDone }.size
i was initially thinking maybe I could do
myScreenState.listOf20Items.flatMap { it.subListOf10Items.anotherSubListOf10Items }
.filter { it.isDone }.size
Adam S
04/13/2023, 5:10 PMcount {}
, which you can use instead of filter {}.size
I think this is nice and readable:
myScreenState
.listOf20Items
.asSequence()
.flatMap { it.subListOf10Items }
.flatMap { it.anotherSubListOf10Items }
.count { it.isDone }
Colton Idle
04/13/2023, 7:14 PM