Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In 2.x, the
to()
operator used the genericFunction
to allow assembly-time conversion of flows into arbitrary types. The drawback of this approach was that each base reactive type had the sameFunction
interface in their method signature, thus it was impossible to implement multiple converters for different reactive types within the same class. To work around this issue, theas
operator andXConverter
interfaces have been introduced in 2.x, which interfaces are distinct and can be implemented on the same class. Changing the signature ofto
in 2.x was not possible due to the pledged binary compatibility of the library.From 3.x, the
as()
methods have been removed and theto()
methods now each work with their respectiveXConverer
interfaces:Flowable.to(Function<Flowable<T>, R>)
is nowFlowable.to(FlowableConverter<T, R>)
Observable.to(Function<Observable<T>, R>)
is nowObservable.to(ObservableConverter<T, R>)
Maybe.to(Function<Flowable<T>, R>)
is nowMaybe.to(MaybeConverter<T, R>)
Single.to(Function<Flowable<T>, R>)
is nowMaybe.to(SingleConverter<T, R>)
Completable.to(Function<Completable, R>)
is nowCompletable.to(CompletableConverter<R>)
ParallelFlowable.to(Function<ParallelFlowable<T>, R)
is nowParallelFlowable.to(ParallelFlowableConverter<T, R>)
If one was using these methods with a lambda expression, only a recompilation is needed:
If one was implementing a Function interface (typically anonymously), the interface type, type arguments and the
throws
clause have to be adjustedResolves: #5654