Skip to content

Commit

Permalink
Add generate examples to Creating-Observables.md in Wiki (#6260)
Browse files Browse the repository at this point in the history
Add documentation and example to the wiki for generate.
  • Loading branch information
elijahverdoorn authored and akarnokd committed Oct 26, 2018
1 parent be0353c commit 9181cbc
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions docs/Creating-Observables.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,27 @@ observable.subscribe(
() -> System.out.println("Done"));
```

## generate

**Available in:** ![image](https://raw.github.com/wiki/ReactiveX/RxJava/images/checkmark_on.png) `Flowable`, ![image](https://raw.github.com/wiki/ReactiveX/RxJava/images/checkmark_on.png) `Observable`, ![image](https://raw.github.com/wiki/ReactiveX/RxJava/images/checkmark_off.png) `Maybe`, ![image](https://raw.github.com/wiki/ReactiveX/RxJava/images/checkmark_off.png) Single`, ![image](https://raw.github.com/wiki/ReactiveX/RxJava/images/checkmark_off.png) `Completable`

**ReactiveX documentation:** [http://reactivex.io/documentation/operators/create.html](http://reactivex.io/documentation/operators/create.html)

Creates a cold, synchronous and stateful generator of values.

#### generate example:

```java
int startValue = 1;
int incrementValue = 1;
Flowable<Integer> flowable = Flowable.generate(() -> startValue, (s, emitter) -> {
int nextValue = s + incrementValue;
emitter.onNext(nextValue);
return nextValue;
});
flowable.subscribe(value -> System.out.println(value));
```

## create

**Available in:** ![image](https://raw.github.com/wiki/ReactiveX/RxJava/images/checkmark_on.png) `Flowable`, ![image](https://raw.github.com/wiki/ReactiveX/RxJava/images/checkmark_on.png) `Observable`, ![image](https://raw.github.com/wiki/ReactiveX/RxJava/images/checkmark_on.png) `Maybe`, ![image](https://raw.github.com/wiki/ReactiveX/RxJava/images/checkmark_on.png) `Single`, ![image](https://raw.github.com/wiki/ReactiveX/RxJava/images/checkmark_on.png) `Completable`
Expand Down

0 comments on commit 9181cbc

Please sign in to comment.