Skip to content

3.x: Check Maybe/Single/Completable operators delegating to Flowable ops #6865

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
akarnokd opened this issue Jan 24, 2020 · 0 comments · Fixed by #6888
Closed

3.x: Check Maybe/Single/Completable operators delegating to Flowable ops #6865

akarnokd opened this issue Jan 24, 2020 · 0 comments · Fixed by #6888

Comments

@akarnokd
Copy link
Member

Some operators in Maybe, Single and Completable are delegating to Flowable operators that may not be the best fit. For example:

    public static <T> Flowable<T> merge(@NonNull Publisher<@NonNull ? extends MaybeSource<? extends T>> sources, int maxConcurrency) {
        Objects.requireNonNull(sources, "sources is null");
        ObjectHelper.verifyPositive(maxConcurrency, "maxConcurrency");
        return RxJavaPlugins.onAssembly(new FlowableFlatMapPublisher(sources, MaybeToPublisher.instance(), false, maxConcurrency, 1));
    }

Can now be:

       return RxJavaPlugins.onAssembly(new FlowableFlatMapMaybe<>(sources, Functions.identity(), false, maxConcurrency)

But, since FlowableFlatMapMaybe takes a Flowable<T>, not a Publisher<T>, a new simple class should be created (FlowableFlatMapMaybePublisher) that takes a Publisher<T> but reuses the internals of FlowableFlatMapMaybe.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant