Java Code Examples for io.reactivex.Observable#toFlowable()
The following examples show how to use
io.reactivex.Observable#toFlowable() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RxJava2CachedCallAdapter.java From retrocache with Apache License 2.0 | 5 votes |
@Override public Object adapt(Call<R> call) { Observable<Response<R>> responseObservable = mAsync ? new CallEnqueueObservable<>(mCachingSystem, call, mResponseType, mAnnotations, mRetrofit) : new CallExecuteObservable<>(mCachingSystem, call, mResponseType, mAnnotations, mRetrofit); Observable<?> observable; if (mResult) { observable = new ResultObservable<>(responseObservable); } else if (mBody) { observable = new BodyObservable<>(responseObservable); } else { observable = responseObservable; } if (mScheduler != null) { observable = observable.subscribeOn(mScheduler); } if (mFlowable) { return observable.toFlowable(BackpressureStrategy.LATEST); } if (mSingle) { return observable.singleOrError(); } if (mMaybe) { return observable.singleElement(); } if (mCompletable) { return observable.ignoreElements(); } return observable; }
Example 2
Source File: SubscriptionTest.java From graphql-spqr with Apache License 2.0 | 5 votes |
@GraphQLSubscription public Publisher<Integer> tick() { Observable<Integer> observable = Observable.create(emitter -> { emitter.onNext(1); Thread.sleep(1000); emitter.onNext(2); Thread.sleep(1000); emitter.onComplete(); }); return observable.toFlowable(BackpressureStrategy.BUFFER); }
Example 3
Source File: ObservableConverter.java From smallrye-reactive-streams-operators with Apache License 2.0 | 4 votes |
@SuppressWarnings("unchecked") @Override public <T> Publisher<T> toRSPublisher(Observable instance) { return instance.toFlowable(BackpressureStrategy.MISSING); }
Example 4
Source File: FlowableIntegrationTest.java From tutorials with MIT License | 4 votes |
@Test public void whenFlowableIsCreatedFromObservable_thenItIsProperlyInitialized() throws InterruptedException { Observable<Integer> integerObservable = Observable.just(1, 2, 3); Flowable<Integer> integerFlowable = integerObservable.toFlowable(BackpressureStrategy.BUFFER); assertNotNull(integerFlowable); }