blob: a08c41fce505c1b61cf654348de7c39ad405e2bc [file] [log] [blame]
Roman Elizarov8a4a8e12017-03-09 19:52:58 +03001/*
Roman Elizarovdb0ef0c2019-07-03 15:02:44 +03002 * Copyright 2016-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
Roman Elizarov8a4a8e12017-03-09 19:52:58 +03003 */
4
5// This file was automatically generated from coroutines-guide-reactive.md by Knit tool. Do not edit.
Roman Elizarov0950dfa2018-07-13 10:33:25 +03006package kotlinx.coroutines.rx2.guide.basic04
Roman Elizarov8a4a8e12017-03-09 19:52:58 +03007
Roman Elizarov95981f32017-03-17 18:12:04 +03008import io.reactivex.*
Roman Elizarov0950dfa2018-07-13 10:33:25 +03009import kotlinx.coroutines.*
10import kotlinx.coroutines.reactive.*
11import kotlin.coroutines.*
Roman Elizarov8a4a8e12017-03-09 19:52:58 +030012
Prendota65e6c8c2018-10-17 11:51:08 +030013fun main() = runBlocking<Unit> {
Roman Elizarov8a4a8e12017-03-09 19:52:58 +030014 val source = Flowable.range(1, 5) // a range of five numbers
15 .doOnSubscribe { println("OnSubscribe") } // provide some insight
Roman Elizarov0dffcfd2018-06-29 18:51:52 +030016 .doOnComplete { println("OnComplete") } // ...
Roman Elizarov8a4a8e12017-03-09 19:52:58 +030017 .doFinally { println("Finally") } // ... into what's going on
Roman Elizarovc961fb62019-04-24 13:01:49 +030018 // collect the source fully
Vsevolod Tolstopyatov0685dc42019-04-24 12:16:56 +030019 source.collect { println(it) }
Roman Elizarov8a4a8e12017-03-09 19:52:58 +030020}