Paul Woitaschek
11/26/2018, 9:30 AMdiesieben07
11/26/2018, 10:29 AMfun main(args: Array<String>) {
runBlocking {
produceDates()
.mapNotNull { it /* something suspending */ }
.firstOrNull()
}
}
fun CoroutineScope.produceDates(): ReceiveChannel<LocalDate> = produce {
generateSequence(LocalDate.now()) { it.minusDays(1) }
.take(10)
.forEach { send(it) }
}
diesieben07
11/26/2018, 10:33 AMgildor
11/26/2018, 1:26 PMgildor
11/26/2018, 1:28 PMPaul Woitaschek
11/26/2018, 3:39 PMbdawg.io
11/26/2018, 5:04 PMgildor
11/27/2018, 1:52 AMIt seems that it’s top priority (DontUseThisAnnotations everywherethis is not related to cold streams directly. Channels will be there even after cold streams release. This is just means that API of channels experimental, may be changed, so you have to use annotations or enable it for your project explictly