Daniel Ryan
07/06/2021, 3:34 PMval ids = listOf(1, 2, 3)
and I have a function that returns a valid thing for a given identifier fun getThing(id: String) : Either<String, Thing?>
what is the best way to execute the getThing function for all ids in the list until a Thing is found, or an either.left is encountered? Traverse is close to what I need, but it will involve unnecessary database calls; I will like to exit processing as soon as a match is found.kierans777
07/06/2021, 11:39 PMFantayeneh
07/10/2021, 11:07 AMids.asSequence().map { getThing(it) }.filter {...}.first()
Daniel Ryan
07/14/2021, 10:38 AM