-
Notifications
You must be signed in to change notification settings - Fork 7.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Initial clean up for Combining Observables docs #6135
Conversation
docs/Combining-Observables.md
Outdated
|
||
#### combineLatest Example | ||
|
||
```java |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i was unsure whether to go with an example like this one or something more abstract but potentially more "useful" like:
Observable<NewsItems> latestNews = getLatestNews();
Observable<Weather> latestWeather = getLatestWeather();
Observable.combineLatest(latestNews, latestWeather, (news, weather) -> Pair(news, weather))
.subscribe(item -> renderUi(item.first, item.second));
and am also unsure how you feel about using time operations in examples since you can't just run them and repro the behavior without blocking the thread somehow (TestObserver
in unit tests or doing the work on a different thread, etc).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer examples that can be tried quickly, thus examples requiring custom types are not good.
docs/Combining-Observables.md
Outdated
#### switchOnNext Example | ||
|
||
```java | ||
Observable<Observable<Long>> timeIntervals = Observable.interval(1, TimeUnit.MILLISECONDS) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i am not happy with this example - any suggestions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have two intertwined intervals. The outer 1 seconds, the inner 100 milliseconds and the inner could be mapped as outer + "-" + inner
so that the switch over to a different value is more clear.
docs/Combining-Observables.md
Outdated
|
||
#### combineLatest Example | ||
|
||
```java |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer examples that can be tried quickly, thus examples requiring custom types are not good.
docs/Combining-Observables.md
Outdated
#### switchOnNext Example | ||
|
||
```java | ||
Observable<Observable<Long>> timeIntervals = Observable.interval(1, TimeUnit.MILLISECONDS) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have two intertwined intervals. The outer 1 seconds, the inner 100 milliseconds and the inner could be mapped as outer + "-" + inner
so that the switch over to a different value is more clear.
docs/Combining-Observables.md
Outdated
|
||
## startWith | ||
|
||
Emit a specified sequence of items before beginning to emit the items from the Observable. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These descriptions are after Available and ReactiveX notes in #6131 btw.
Thanks for your contribution and keep up the good work! 👍 I'll merge this once the Travis CI service works properly again. |
Codecov Report
@@ Coverage Diff @@
## 2.x #6135 +/- ##
============================================
- Coverage 98.31% 98.28% -0.04%
- Complexity 6192 6197 +5
============================================
Files 667 667
Lines 44853 44853
Branches 6213 6213
============================================
- Hits 44097 44082 -15
- Misses 228 232 +4
- Partials 528 539 +11
Continue to review full report at Codecov.
|
This patch updates the style of the combining observables documentation to be similar to that of #6131 and adds examples for most of the operators therein. Refs #6132.
What's left for combining observables:
join
,groupJoin
, andrxjava-joins
concat
,concatEager
, andwithLatestFrom