Created
November 6, 2017 23:12
-
-
Save jonathanrz/1c5e33082dda4b05fcc5343ef7d47dd4 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| import io.reactivex.Observable; | |
| import io.reactivex.subjects.BehaviorSubject; | |
| public class Q47000608 { | |
| public static void main(String[] args) { | |
| BehaviorSubject<Integer> bs = BehaviorSubject.createDefault(1); | |
| Observable<Integer> o = bs.replay(1).autoConnect().distinctUntilChanged(); | |
| o.subscribe(i -> System.out.println("s1 accept " + i)); | |
| bs.onNext(2); | |
| o.subscribe(i -> System.out.println("s2 accept " + i)); | |
| o.subscribe(i -> System.out.println("s3 accept " + i)); | |
| bs.onNext(3); | |
| o.subscribe(i -> System.out.println("s4 accept " + i)); | |
| bs.onNext(4); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment