I\'m trying to get my head around the golden rule (if any) about:
When to use BehaviorSubject ?
and
When to
The main difference between PublishSubject
and BehaviorSubject
is that the latter one remembers the last emitted item. Because of that BehaviorSubject
is really useful when you want to emit states
.
Why they make project field a BehaviorSubject and not PublishSubject ?
Probably because they want to be able to retrieve the last emitted project with this method:
@Override public @NonNull Observable project() {
return this.project;
}