These are chat archives for ReactiveX/RxJava

23rd
Nov 2016
DavidMihola
@DavidMihola
Nov 23 2016 12:56
Just a quick question: In RxJava 1.2.x, what's the difference between a BehaviorSubject.create() and a ReplaySubject.createWithSize(1)?
David Karnok
@akarnokd
Nov 23 2016 13:28
BehaviorSubject doesn't retain the last emitted value if it gets terminated, ReplaySubject does.
DavidMihola
@DavidMihola
Nov 23 2016 13:30
And "if it get's terminated" in this context means - that the number of Subscribers goes back down to 0? If so, does that also apply if I subscribe "into" the Subject, i. e. myObservable.subscribe(mySubject)?
David Karnok
@akarnokd
Nov 23 2016 13:31
terminated == onError or onCompleted gets called
DavidMihola
@DavidMihola
Nov 23 2016 13:33
Oh, yes, I am sorry. OK, so after onError/onCompleted in a ReplaySubject.createWithSize(1) I get the last regular item AND the terminating event; in a BehaviorSubject.create() I get ONLY the terminating event. Right?
David Karnok
@akarnokd
Nov 23 2016 13:34
Yes.
DavidMihola
@DavidMihola
Nov 23 2016 13:35
Perfect! As always, thank you very much for your help!