Foggy day

Android(Kotlin) - RxKotlin -1 : PublishSubject 본문

Android

Android(Kotlin) - RxKotlin -1 : PublishSubject

jinhan38 2021. 3. 23. 21:52

 

 

   val items: PublishSubject<Int> = PublishSubject.create()
        items.onNext(1)
        items.onNext(2)
        items.onNext(3)

        items.filter { i -> i % 2 == 0 }.subscribe(::println)
        items.onNext(4)
        items.onNext(5)
        items.onNext(6)
        items.onNext(7)
        items.onNext(8)