RxJava2 - Mutlicasting Singles, Maybes and Completables?

What is the recommended way to multicast single player, Maybes and Completables? Is it recommended that you simply translate them into standard observables for multicast?

    Observable<String> strings =
            Observable.just("Alpha", "Beta", "Gamma", "Delta", "Epsilon");

    Observable<Integer> lengths = strings.map(String::length);

    ConnectableObservable<List<Integer>> lengthsList = 
            lengths.toList().toObservable().publish();

I am a little surprised that not ConnectableSingle, ConnectableMaybeand ConnectableCompletable. What are the reasons for this? Isn't it worth the effort for development?

+4
source share
1 answer

I think .toObservable().publish()this is the way to go.

0
source

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


All Articles