Skip to content

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

Closed
@akarnokd

Description

@akarnokd

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.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions