rxstate icon indicating copy to clipboard operation
rxstate copied to clipboard

This project is implementation of ideas from "Managing state reactive way" article.

RxState

This project is implementation of ideas from Managing state reactive way article.

RxJava1 dependency

Maven Central

dependencies {
    compile 'com.konmik.rxstate:rxstate1:0.1.0-beta1'
}
RxJava2 dependency

Maven Central

dependencies {
    compile 'com.konmik.rxstate:rxstate2:0.1.0-beta1'
}

Usage

Code (RxJava1):

    RxState<Integer> state = new RxState<>(0, Schedulers.immediate());
    state.values(StartWith.SCHEDULE)
            .subscribe(it -> System.out.println(it));
    state.apply(it -> it + 1);

Code (RxJava2):

    RxState<Integer> state = new RxState<>(0, Schedulers.single());
    state.values(StartWith.SCHEDULE)
            .subscribe(it -> System.out.println(it));
    state.apply(it -> it + 1);

Prints:

0
1