Skip to content

Commit fd4377f

Browse files
kimkevinakarnokd
authored andcommitted
Improved code formatting for README.md (#5737)
1 parent 85ceeb5 commit fd4377f

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ Flowable.just("Hello world")
6868

6969
RxJava 2 features several base classes you can discover operators on:
7070

71-
- `io.reactivex.Flowable` : 0..N flows, supporting Reactive-Streams and backpressure
71+
- `io.reactivex.Flowable`: 0..N flows, supporting Reactive-Streams and backpressure
7272
- `io.reactivex.Observable`: 0..N flows, no backpressure
7373
- `io.reactivex.Single`: a flow of exactly 1 item or an error
7474
- `io.reactivex.Completable`: a flow without items but only a completion or error signal
@@ -133,7 +133,7 @@ Flowable.range(1, 10)
133133
.subscribeOn(Schedulers.computation())
134134
.map(w -> w * w)
135135
)
136-
.blockingSubscribe(System.out::println);
136+
.blockingSubscribe(System.out::println);
137137
```
138138

139139
Practically, paralellism in RxJava means running independent flows and merging their results back into a single flow. The operator `flatMap` does this by first mapping each number from 1 to 10 into its own individual `Flowable`, runs them and merges the computed squares.
@@ -142,11 +142,11 @@ Starting from 2.0.5, there is an *experimental* operator `parallel()` and type `
142142

143143
```java
144144
Flowable.range(1, 10)
145-
.parallel()
146-
.runOn(Schedulers.computation())
147-
.map(v -> v * v)
148-
.sequential()
149-
.blockingSubscribe(System.out::println);
145+
.parallel()
146+
.runOn(Schedulers.computation())
147+
.map(v -> v * v)
148+
.sequential()
149+
.blockingSubscribe(System.out::println);
150150
```
151151

152152
`flatMap` is a powerful operator and helps in a lot of situations. For example, given a service that returns a `Flowable`, we'd like to call another service with values emitted by the first service:
@@ -158,8 +158,8 @@ inventorySource.flatMap(inventoryItem ->
158158
erp.getDemandAsync(inventoryItem.getId())
159159
.map(demand
160160
-> System.out.println("Item " + inventoryItem.getName() + " has demand " + demand));
161-
)
162-
.subscribe();
161+
)
162+
.subscribe();
163163
```
164164

165165
Note, however, that `flatMap` doesn't guarantee any order and the end result from the inner flows may end up interleaved. There are alternative operators:

0 commit comments

Comments
 (0)