|
3 | 3 | <a href='https://travis-ci.org/akarnokd/RxJava2Extensions/builds'><img src='https://travis-ci.org/akarnokd/RxJava2Extensions.svg?branch=master'></a>
|
4 | 4 | [](http://codecov.io/github/akarnokd/RxJava2Extensions?branch=master)
|
5 | 5 | [](https://maven-badges.herokuapp.com/maven-central/com.github.akarnokd/rxjava2-extensions)
|
| 6 | +[](https://maven-badges.herokuapp.com/maven-central/io.reactivex.rxjava2/rxjava) |
6 | 7 |
|
7 |
| -Extra sources, operators and components and ports of many 1.x companion libraries for RxJava 2.x. |
| 8 | +RxJava 2.x implementation of extra sources, operators and components and ports of many 1.x companion libraries. |
8 | 9 |
|
9 | 10 | # Releases
|
10 | 11 |
|
11 | 12 | **gradle**
|
12 | 13 |
|
13 | 14 | ```
|
14 | 15 | dependencies {
|
15 |
| - compile "com.github.akarnokd:rxjava2-extensions:0.13.0" |
| 16 | + compile "com.github.akarnokd:rxjava2-extensions:0.14.0" |
16 | 17 | }
|
17 | 18 | ```
|
18 | 19 |
|
@@ -736,7 +737,7 @@ ts.assertResult();
|
736 | 737 |
|
737 | 738 | The `Publisher`-based sibling of the `Single` type. The usage is practically the same as `Single` with the exception that because `Solo` implements the Reactive-Streams `Publisher`, you can use it directly with operators of `Flowable` that accept `Publisher` in some form.
|
738 | 739 |
|
739 |
| -`Solo`'s emission protocol is a restriction over the general `Publisher` protocol: one either calls `onNext` followed by `onComplete` or just `onError`. Operators will and should never call `onNext` followed by `onError` or `onComplete` on its own. Note that some operators may react to `onNext` immediately not waiting for an `onComplete` but on their emission side, `onComplete` is always called. |
| 740 | +`Solo`'s emission protocol is a restriction over the general `Publisher` protocol: one either calls `onNext` followed by `onComplete` or just `onError`. Operators will and should never call `onNext` followed by `onError` or `onComplete` on its own. Note that some operators may react to `onNext` immediately not waiting for an `onComplete` but on their emission side, `onComplete` is always called after an `onNext`. |
740 | 741 |
|
741 | 742 | Examples:
|
742 | 743 |
|
@@ -772,6 +773,46 @@ ts.assertResult(1);
|
772 | 773 |
|
773 | 774 | ### Perhaps - 0-1-error publisher
|
774 | 775 |
|
775 |
| -In progress... |
| 776 | +The `Publisher`-based sibling of the `Maybe` type. The usage is practically the same as `Maybe` with the exception that because `Perhaps` implements the Reactive-Streams `Publisher`, you can use it directly with operators of `Flowable` that accept `Publisher` in some form. |
776 | 777 |
|
| 778 | +`Perhaps`'s emission protocol is a restriction over the general `Publisher` protocol: one either calls `onNext` followed by `onComplete`, `onComplete` only or just `onError`. Operators will and should never call `onNext` followed by `onError` on its own. Note that some operators may react to `onNext` immediately not waiting for an `onComplete` but on their emission side, `onComplete` is always called after an `onNext`. |
| 779 | + |
| 780 | +Examples: |
| 781 | + |
| 782 | +```java |
| 783 | +Perhaps.fromCallable(() -> { |
| 784 | + System.out.println("Hello world!"); |
| 785 | + return 1; |
| 786 | +}).subscribe(); |
| 787 | + |
| 788 | +Perhaps.fromCallable(() -> "Hello world!") |
| 789 | + .delay(1, TimeUnit.SECONDS) |
| 790 | + .blockingSubscribe(System.out::println); |
| 791 | + |
| 792 | +Flowable.concat(Perhaps.just(1), Perhaps.just(2)) |
| 793 | +.test() |
| 794 | +.assertResult(1, 2); |
| 795 | + |
| 796 | +Perhaps.fromCallable(() -> { |
| 797 | + System.out.println("Hello world!"); |
| 798 | + return null; // null is considered to indicate an empty Perhaps |
| 799 | +}) |
| 800 | +.test() |
| 801 | +.assertResult(); |
| 802 | +``` |
| 803 | + |
| 804 | +#### PerhapsProcessor |
| 805 | + |
| 806 | +A hot, Reactive-Streams `Processor` implementation of `Perhaps`. |
| 807 | + |
| 808 | +```java |
| 809 | +PerhapsProcessor<Integer> ph = PerhapsProcessor.create(); |
| 810 | + |
| 811 | +TestSubscriber<Integer> ts = ph.test(); |
| 812 | + |
| 813 | +ph.onNext(1); |
| 814 | +ph.onComplete(); |
| 815 | + |
| 816 | +ts.assertResult(1); |
| 817 | +``` |
777 | 818 |
|
0 commit comments