Created
December 3, 2018 12:11
-
-
Save anitaa1990/3b41656f7f364293ae4a66b4e17d099b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PublishSubject<Integer> pSubject = PublishSubject.create(); | |
pSubject.onNext(0); | |
pSubject.subscribe(it -> System.out.println("Observer 1 onNext: " + it), | |
(Throwable error) -> { }, () -> {}, | |
on1 -> System.out.println("Observer 1 onSubscribe")); | |
pSubject.onNext(1); | |
pSubject.onNext(2); | |
pSubject.subscribe(it -> System.out.println("Observer 2 onNext: " + it), | |
(Throwable error) -> { }, () -> {}, | |
on1 -> System.out.println("Observer 2 onSubscribe")); | |
pSubject.onNext(3); | |
pSubject.onNext(4); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment