Where is Observable # asObservable () in RxJava2?

I would like to watch mine BehaviourSubject. In RxJava 1, I called asObservable () , which is now gone.

I found publish(), but it returns connectable, which I don't want.

How to incorporate subject behavior into observable in RxJava 2?

+4
source share
2 answers

You may be looking for Observable.hide()

Hides the identity of this Observable and its one-time use. Allows hiding additional functions, such as Subject Observer methods or preventing certain optimizations based on identification (merging).

+6
source

From What is different in version 2.0 , from 1.x Observable to 2.x Flowable:

asObservable: hide(),

, , hide - , .

+6

Source: https://habr.com/ru/post/1672834/


All Articles