Skip to content

akarnokd/RxJavaBridge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

78 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RxJavaBridge

Bridge between RxJava 2 and RxJava 3.

Build codecov.io Maven Central

RxJava 2: Maven Central

RxJava 3: Maven Central

dependencies {
    implementation "com.github.akarnokd:rxjava3-bridge:3.0.2"
}

Features

Convert between Flowables

via static methods

import hu.akarnokd.rxjava3.bridge.RxJavaBridge;

io.reactivex.Flowable              f2 = RxJavaBridge.toV2Flowable(io.reactivex.rxjava3.core.Flowable)

io.reactivex.rxjava3.core.Flowable f3 = RxJavaBridge.toV3Flowable(io.reactivex.Flowable)

via FlowableConverter application

f3 = f2.as(RxJavaBridge.toV3Flowable())

f2 = f3.to(RxJavaBridge.toV2Flowable())

Convert between Observables

via static methods

import hu.akarnokd.rxjava3.bridge.RxJavaBridge;

io.reactivex.Observable              o2 = RxJavaBridge.toV2Observable(io.reactivex.rxjava3.core.Observable)

io.reactivex.rxjava3.core.Observable o3 = RxJavaBridge.toV3Observable(io.reactivex.Observable)

via ObservableConverter application

o3 = o2.as(RxJavaBridge.toV3Observable())

o2 = o3.to(RxJavaBridge.toV2Observable())

Convert between Maybes

via static methods

import hu.akarnokd.rxjava3.bridge.RxJavaBridge;

io.reactivex.Maybe              m2 = RxJavaBridge.toV2Maybe(io.reactivex.rxjava3.core.Maybe)

io.reactivex.rxjava3.core.Maybe m3 = RxJavaBridge.toV3Maybe(io.reactivex.Maybe)

via MaybeConverter application

m3 = m2.as(RxJavaBridge.toV3Maybe())

m2 = m3.to(RxJavaBridge.toV2Maybe())

Convert between Singles

via static methods

import hu.akarnokd.rxjava3.bridge.RxJavaBridge;

io.reactivex.Single              s2 = RxJavaBridge.toV2Single(io.reactivex.rxjava3.core.Single)

io.reactivex.rxjava3.core.Single s3 = RxJavaBridge.toV3Single(io.reactivex.Single)

via SingleConverter application

s3 = s2.as(RxJavaBridge.toV3Single())

s2 = s3.to(RxJavaBridge.toV2Single())

Convert between Completables

via static methods

import hu.akarnokd.rxjava3.bridge.RxJavaBridge;

io.reactivex.Completable              c2 = RxJavaBridge.toV2Completable(io.reactivex.rxjava3.core.Completable)

io.reactivex.rxjava3.core.Completable c3 = RxJavaBridge.toV3Completable(io.reactivex.Completable)

via CompletableConverter application

c3 = c2.as(RxJavaBridge.toV3Completable())

c2 = c3.to(RxJavaBridge.toV2Completable())

Convert between Disposables

via static methods

import hu.akarnokd.rxjava3.bridge.RxJavaBridge;

io.reactivex.disposables.Disposable        d2 = RxJavaBridge.toV2Disposable(io.reactivex.rxjava3.disposables.Disposable)

io.reactivex.rxjava3.disosables.Observable d3 = RxJavaBridge.toV3Disposable(io.reactivex.disposables.Disposable)

Convert between Schedulers

via static methods

import hu.akarnokd.rxjava3.bridge.RxJavaBridge;

io.reactivex.Scheduler              sch2 = RxJavaBridge.toV2Scheduler(io.reactivex.rxjava3.core.Scheduler)

io.reactivex.rxjava3.core.Scheduler sch3 = RxJavaBridge.toV3Scheduler(io.reactivex.Scheduler)

use 3.x standard schedulers in 2.x

import hu.akarnokd.rxjava3.bridge.RxJavaBridge;

io.reactivex.schedulers.Schedulers.shutdown();

RxJavaBridge.startUsingV3Schedulers();

// when done

RxJavaBridge.stopUsingV3Schedulers();

io.reactivex.schedulers.Schedulers.start();

use 2.x standard schedulers in 3.x

import hu.akarnokd.rxjava3.bridge.RxJavaBridge;

io.reactivex.rxjava3.schedulers.Schedulers.shutdown();

RxJavaBridge.startUsingV2Schedulers();

// when done

RxJavaBridge.stopUsingV2Schedulers();

io.reactivex.rxjava3.schedulers.Schedulers.start();