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

2.x: Observable.compose to use ObservableTransformer #4658

Merged
merged 1 commit into from
Oct 2, 2016
Merged
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
2 changes: 1 addition & 1 deletion src/main/java/io/reactivex/Observable.java
Original file line number Diff line number Diff line change
Expand Up @@ -5488,7 +5488,7 @@ public final <U> Single<U> collectInto(final U initialValue, BiConsumer<? super
* @see <a href="https://github.com/ReactiveX/RxJava/wiki/Implementing-Your-Own-Operators">RxJava wiki: Implementing Your Own Operators</a>
*/
@SchedulerSupport(SchedulerSupport.NONE)
public final <R> Observable<R> compose(Function<? super Observable<T>, ? extends ObservableSource<R>> composer) {
public final <R> Observable<R> compose(ObservableTransformer<T, R> composer) {
return wrap(to(composer));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@

import java.util.*;

import io.reactivex.Completable;
import io.reactivex.SingleSource;
import io.reactivex.exceptions.TestException;
import org.junit.Test;

import io.reactivex.Single;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public void accept(Movie pv) {
System.out.println(pv);
}
})
.compose(new Function<Observable<Movie>, Observable<Movie>>() {
.compose(new ObservableTransformer<Movie, Movie>() {
@Override
public Observable<Movie> apply(Observable<Movie> m) {
return m.concatWith(Observable.just(new ActionMovie()));
Expand All @@ -116,7 +116,7 @@ public String apply(Movie v) {
@Test
public void testCovarianceOfCompose() {
Observable<HorrorMovie> movie = Observable.just(new HorrorMovie());
Observable<Movie> movie2 = movie.compose(new Function<Observable<HorrorMovie>, Observable<Movie>>() {
Observable<Movie> movie2 = movie.compose(new ObservableTransformer<HorrorMovie, Movie>() {
@Override
public Observable<Movie> apply(Observable<HorrorMovie> t) {
return Observable.just(new Movie());
Expand All @@ -128,7 +128,7 @@ public Observable<Movie> apply(Observable<HorrorMovie> t) {
@Test
public void testCovarianceOfCompose2() {
Observable<Movie> movie = Observable.<Movie> just(new HorrorMovie());
Observable<HorrorMovie> movie2 = movie.compose(new Function<Observable<Movie>, Observable<HorrorMovie>>() {
Observable<HorrorMovie> movie2 = movie.compose(new ObservableTransformer<Movie, HorrorMovie>() {
@Override
public Observable<HorrorMovie> apply(Observable<Movie> t) {
return Observable.just(new HorrorMovie());
Expand All @@ -140,7 +140,7 @@ public Observable<HorrorMovie> apply(Observable<Movie> t) {
@Test
public void testCovarianceOfCompose3() {
Observable<Movie> movie = Observable.<Movie>just(new HorrorMovie());
Observable<HorrorMovie> movie2 = movie.compose(new Function<Observable<Movie>, Observable<HorrorMovie>>() {
Observable<HorrorMovie> movie2 = movie.compose(new ObservableTransformer<Movie, HorrorMovie>() {
@Override
public Observable<HorrorMovie> apply(Observable<Movie> t) {
return Observable.just(new HorrorMovie()).map(new Function<HorrorMovie, HorrorMovie>() {
Expand All @@ -158,7 +158,7 @@ public HorrorMovie apply(HorrorMovie v) {
@Test
public void testCovarianceOfCompose4() {
Observable<HorrorMovie> movie = Observable.just(new HorrorMovie());
Observable<HorrorMovie> movie2 = movie.compose(new Function<Observable<HorrorMovie>, Observable<HorrorMovie>>() {
Observable<HorrorMovie> movie2 = movie.compose(new ObservableTransformer<HorrorMovie, HorrorMovie>() {
@Override
public Observable<HorrorMovie> apply(Observable<HorrorMovie> t1) {
return t1.map(new Function<HorrorMovie, HorrorMovie>() {
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/io/reactivex/observable/ObservableTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -1087,7 +1087,7 @@ public void accept(List<Boolean> booleans) {
@Test
public void testCompose() {
TestObserver<String> ts = new TestObserver<String>();
Observable.just(1, 2, 3).compose(new Function<Observable<Integer>, Observable<String>>() {
Observable.just(1, 2, 3).compose(new ObservableTransformer<Integer, String>() {
@Override
public Observable<String> apply(Observable<Integer> t1) {
return t1.map(new Function<Integer, String>() {
Expand Down