Skip to content
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

Extends function #6774

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,24 @@

import io.reactivex.rxjava3.annotations.NonNull;

import java.util.function.Function;

/**
* Convenience interface and callback used by the {@link Completable#to} operator to turn a Completable into another
* value fluently.
* <p>History: 2.1.7 - experimental
* @param <R> the output type
* @since 2.2
*/
public interface CompletableConverter<R> {
@FunctionalInterface
public interface CompletableConverter<R> extends Function<Completable, R> {
/**
* Applies a function to the upstream Completable and returns a converted value of type {@code R}.
*
* @param upstream the upstream Completable instance
* @return the converted value
*/
@NonNull
@Override
R apply(@NonNull Completable upstream);
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
* an instance of a {@link CompletableEmitter} instance that allows pushing
* an event in a cancellation-safe manner.
*/
@FunctionalInterface
public interface CompletableOnSubscribe {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
/**
* Interface to map/wrap a downstream observer to an upstream observer.
*/
@FunctionalInterface
public interface CompletableOperator {
/**
* Applies a function to the child CompletableObserver and returns a new parent CompletableObserver.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
*
* @since 2.0
*/
@FunctionalInterface
public interface CompletableSource {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,20 @@

import io.reactivex.rxjava3.annotations.NonNull;

import java.util.function.Function;

/**
* Convenience interface and callback used by the compose operator to turn a Completable into another
* Completable fluently.
*/
public interface CompletableTransformer {
@FunctionalInterface
public interface CompletableTransformer extends Function<Completable, CompletableSource> {
/**
* Applies a function to the upstream Completable and returns a CompletableSource.
* @param upstream the upstream Completable instance
* @return the transformed CompletableSource instance
*/
@NonNull
@Override
CompletableSource apply(@NonNull Completable upstream);
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

import io.reactivex.rxjava3.annotations.NonNull;

import java.util.function.Function;

/**
* Convenience interface and callback used by the {@link Flowable#to} operator to turn a Flowable into another
* value fluently.
Expand All @@ -23,13 +25,15 @@
* @param <R> the output type
* @since 2.2
*/
public interface FlowableConverter<T, R> {
@FunctionalInterface
public interface FlowableConverter<T, R> extends Function<Flowable<T>, R> {
/**
* Applies a function to the upstream Flowable and returns a converted value of type {@code R}.
*
* @param upstream the upstream Flowable instance
* @return the converted value
*/
@NonNull
@Override
R apply(@NonNull Flowable<T> upstream);
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
*
* @param <T> the value type pushed
*/
@FunctionalInterface
public interface FlowableOnSubscribe<T> {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
* @param <Downstream> the value type of the downstream
* @param <Upstream> the value type of the upstream
*/
@FunctionalInterface
public interface FlowableOperator<Downstream, Upstream> {
/**
* Applies a function to the child Subscriber and returns a new parent Subscriber.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,23 @@

import io.reactivex.rxjava3.annotations.NonNull;

import java.util.function.Function;

/**
* Interface to compose Flowables.
*
* @param <Upstream> the upstream value type
* @param <Downstream> the downstream value type
*/
public interface FlowableTransformer<Upstream, Downstream> {
@FunctionalInterface
public interface FlowableTransformer<Upstream, Downstream> extends Function<Flowable<Upstream>, Publisher<Downstream>> {
/**
* Applies a function to the upstream Flowable and returns a Publisher with
* optionally different element type.
* @param upstream the upstream Flowable instance
* @return the transformed Publisher instance
*/
@NonNull
@Override
Publisher<Downstream> apply(@NonNull Flowable<Upstream> upstream);
}
6 changes: 5 additions & 1 deletion src/main/java/io/reactivex/rxjava3/core/MaybeConverter.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

import io.reactivex.rxjava3.annotations.NonNull;

import java.util.function.Function;

/**
* Convenience interface and callback used by the {@link Maybe#to} operator to turn a Maybe into another
* value fluently.
Expand All @@ -23,13 +25,15 @@
* @param <R> the output type
* @since 2.2
*/
public interface MaybeConverter<T, R> {
@FunctionalInterface
public interface MaybeConverter<T, R> extends Function<Maybe<T>, R> {
/**
* Applies a function to the upstream Maybe and returns a converted value of type {@code R}.
*
* @param upstream the upstream Maybe instance
* @return the converted value
*/
@NonNull
@Override
R apply(@NonNull Maybe<T> upstream);
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
*
* @param <T> the value type pushed
*/
@FunctionalInterface
public interface MaybeOnSubscribe<T> {

/**
Expand Down
1 change: 1 addition & 0 deletions src/main/java/io/reactivex/rxjava3/core/MaybeOperator.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
* @param <Downstream> the value type of the downstream
* @param <Upstream> the value type of the upstream
*/
@FunctionalInterface
public interface MaybeOperator<Downstream, Upstream> {
/**
* Applies a function to the child MaybeObserver and returns a new parent MaybeObserver.
Expand Down
1 change: 1 addition & 0 deletions src/main/java/io/reactivex/rxjava3/core/MaybeSource.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
* @param <T> the element type
* @since 2.0
*/
@FunctionalInterface
public interface MaybeSource<T> {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,23 @@

import io.reactivex.rxjava3.annotations.NonNull;

import java.util.function.Function;

/**
* Interface to compose Maybes.
*
* @param <Upstream> the upstream value type
* @param <Downstream> the downstream value type
*/
public interface MaybeTransformer<Upstream, Downstream> {
@FunctionalInterface
public interface MaybeTransformer<Upstream, Downstream> extends Function<Maybe<Upstream>, MaybeSource<Downstream>> {
/**
* Applies a function to the upstream Maybe and returns a MaybeSource with
* optionally different element type.
* @param upstream the upstream Maybe instance
* @return the transformed MaybeSource instance
*/
@NonNull
@Override
MaybeSource<Downstream> apply(@NonNull Maybe<Upstream> upstream);
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

import io.reactivex.rxjava3.annotations.NonNull;

import java.util.function.Function;

/**
* Convenience interface and callback used by the {@link Observable#to} operator to turn an Observable into another
* value fluently.
Expand All @@ -23,13 +25,15 @@
* @param <R> the output type
* @since 2.2
*/
public interface ObservableConverter<T, R> {
@FunctionalInterface
public interface ObservableConverter<T, R> extends Function<Observable<T>, R> {
/**
* Applies a function to the upstream Observable and returns a converted value of type {@code R}.
*
* @param upstream the upstream Observable instance
* @return the converted value
*/
@NonNull
@Override
R apply(@NonNull Observable<T> upstream);
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
*
* @param <T> the value type pushed
*/
@FunctionalInterface
public interface ObservableOnSubscribe<T> {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
* @param <Downstream> the value type of the downstream
* @param <Upstream> the value type of the upstream
*/
@FunctionalInterface
public interface ObservableOperator<Downstream, Upstream> {
/**
* Applies a function to the child Observer and returns a new parent Observer.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
* @param <T> the element type
* @since 2.0
*/
@FunctionalInterface
public interface ObservableSource<T> {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,23 @@

import io.reactivex.rxjava3.annotations.NonNull;

import java.util.function.Function;

/**
* Interface to compose Observables.
*
* @param <Upstream> the upstream value type
* @param <Downstream> the downstream value type
*/
public interface ObservableTransformer<Upstream, Downstream> {
@FunctionalInterface
public interface ObservableTransformer<Upstream, Downstream> extends Function<Observable<Upstream>, ObservableSource<Downstream>> {
/**
* Applies a function to the upstream Observable and returns an ObservableSource with
* optionally different element type.
* @param upstream the upstream Observable instance
* @return the transformed ObservableSource instance
*/
@NonNull
@Override
ObservableSource<Downstream> apply(@NonNull Observable<Upstream> upstream);
}
6 changes: 5 additions & 1 deletion src/main/java/io/reactivex/rxjava3/core/SingleConverter.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

import io.reactivex.rxjava3.annotations.NonNull;

import java.util.function.Function;

/**
* Convenience interface and callback used by the {@link Single#to} operator to turn a Single into another
* value fluently.
Expand All @@ -23,13 +25,15 @@
* @param <R> the output type
* @since 2.2
*/
public interface SingleConverter<T, R> {
@FunctionalInterface
public interface SingleConverter<T, R> extends Function<Single<T>, R> {
/**
* Applies a function to the upstream Single and returns a converted value of type {@code R}.
*
* @param upstream the upstream Single instance
* @return the converted value
*/
@NonNull
@Override
R apply(@NonNull Single<T> upstream);
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
*
* @param <T> the value type pushed
*/
@FunctionalInterface
public interface SingleOnSubscribe<T> {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
* @param <Downstream> the value type of the downstream
* @param <Upstream> the value type of the upstream
*/
@FunctionalInterface
public interface SingleOperator<Downstream, Upstream> {
/**
* Applies a function to the child SingleObserver and returns a new parent SingleObserver.
Expand Down
1 change: 1 addition & 0 deletions src/main/java/io/reactivex/rxjava3/core/SingleSource.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
* @param <T> the element type
* @since 2.0
*/
@FunctionalInterface
public interface SingleSource<T> {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,23 @@

import io.reactivex.rxjava3.annotations.NonNull;

import java.util.function.Function;

/**
* Interface to compose Singles.
*
* @param <Upstream> the upstream value type
* @param <Downstream> the downstream value type
*/
public interface SingleTransformer<Upstream, Downstream> {
@FunctionalInterface
public interface SingleTransformer<Upstream, Downstream> extends Function<Single<Upstream>, SingleSource<Downstream>> {
/**
* Applies a function to the upstream Single and returns a SingleSource with
* optionally different element type.
* @param upstream the upstream Single instance
* @return the transformed SingleSource instance
*/
@NonNull
@Override
SingleSource<Downstream> apply(@NonNull Single<Upstream> upstream);
}
1 change: 1 addition & 0 deletions src/main/java/io/reactivex/rxjava3/functions/Action.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
/**
* A functional interface similar to Runnable but allows throwing a checked exception.
*/
@FunctionalInterface
public interface Action {
/**
* Runs the action and optionally throws a checked exception.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
* @param <T1> the first value type
* @param <T2> the second value type
*/
@FunctionalInterface
public interface BiConsumer<T1, T2> {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
* @param <T2> the second value type
* @param <R> the result type
*/
@FunctionalInterface
public interface BiFunction<T1, T2, R> {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
* @param <T1> the first value
* @param <T2> the second value
*/
@FunctionalInterface
public interface BiPredicate<T1, T2> {

/**
Expand Down
Loading