-
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
#6323 Java 8 version for Problem-Solving-Examples-in-RxJava #6324
Conversation
Codecov Report
@@ Coverage Diff @@
## 2.x #6324 +/- ##
============================================
+ Coverage 98.23% 98.24% +<.01%
- Complexity 6284 6288 +4
============================================
Files 672 672
Lines 44992 44992
Branches 6223 6223
============================================
+ Hits 44198 44202 +4
- Misses 253 254 +1
+ Partials 541 536 -5
Continue to review full report at Codecov.
|
@@ -47,10 +70,23 @@ summer.subscribe({println(it);}); | |||
How could you create an Observable that emits [the Fibonacci sequence](http://en.wikipedia.org/wiki/Fibonacci_number)? | |||
|
|||
The most direct way would be to use the [`create`](Creating-Observables#wiki-create) operator to make an Observable "from scratch," and then use a traditional loop within the closure you pass to that operator to generate the sequence. Something like this: | |||
### Java | |||
```java | |||
Observable<Integer> fibonacci = Observable.create(observer -> { |
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.
Could you use v2 terminology here? emitter ->
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.
done! Thank for reviewing 👍
```java | ||
Observable<Integer> fibonacci = Observable.create(observer -> { | ||
int f1 = 0, f2 = 1, f = 1; | ||
while (!observer.isUnsubscribed()) { |
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.
v2: !emitter.isDisposed()
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.
done! Thank for reviewing 👍
def f1=0; f2=1, f=1; | ||
while(!observer.isUnsubscribed() { | ||
def f1=0, f2=1, f=1; | ||
while(!observer.isUnsubscribed()) { |
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.
Same here for v2.
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.
done! Thank for reviewing 👍
### Java | ||
```java | ||
Observable<Integer> fibonacci = Observable.fromArray(0) | ||
.repeat() |
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.
Please reformat this so that the operators do not trigger a horizontal scrollbar on smaller screens. For example, move Observable.fromArray(0)
to an indented new line and line up the operators there.
Observable<Integer> fibonacci =
Observable.fromArray(0)
.repeat()
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.
done! Thank for reviewing 👍
Hi @akarnokd, i am done all for requesting changes. |
I am adding Java 8 version for Problem-Solving-Examples-in-RxJava.
Please help me review.
Thanks!