Skip to content
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

Merged
merged 4 commits into from
Dec 10, 2018

Conversation

hoangnam2261
Copy link
Contributor

I am adding Java 8 version for Problem-Solving-Examples-in-RxJava.
Please help me review.
Thanks!

@codecov
Copy link

codecov bot commented Nov 29, 2018

Codecov Report

Merging #6324 into 2.x will increase coverage by <.01%.
The diff coverage is n/a.

Impacted file tree graph

@@             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
Impacted Files Coverage Δ Complexity Δ
...nternal/operators/parallel/ParallelReduceFull.java 91.08% <0%> (-3.97%) 2% <0%> (ø)
...l/operators/observable/ObservableFlatMapMaybe.java 88.88% <0%> (-3.27%) 2% <0%> (ø)
...nternal/operators/observable/ObservableCreate.java 95.72% <0%> (-2.57%) 2% <0%> (ø)
...va/io/reactivex/internal/queue/SpscArrayQueue.java 97.61% <0%> (-2.39%) 22% <0%> (-1%)
...rnal/operators/flowable/FlowableFlatMapSingle.java 94.56% <0%> (-1.64%) 2% <0%> (ø)
...ernal/operators/flowable/FlowableFlatMapMaybe.java 89.37% <0%> (-1.45%) 2% <0%> (ø)
...ternal/operators/completable/CompletableMerge.java 96.42% <0%> (-1.2%) 2% <0%> (ø)
...java/io/reactivex/processors/UnicastProcessor.java 98.8% <0%> (-1.2%) 67% <0%> (-1%)
...ivex/internal/operators/maybe/MaybeMergeArray.java 96.62% <0%> (-1.13%) 6% <0%> (ø)
.../io/reactivex/internal/schedulers/IoScheduler.java 89.36% <0%> (-1.07%) 9% <0%> (ø)
... and 19 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6ae765a...84022f6. Read the comment docs.

@@ -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 -> {
Copy link
Member

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 ->

Copy link
Contributor Author

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()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

v2: !emitter.isDisposed()

Copy link
Contributor Author

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()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here for v2.

Copy link
Contributor Author

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()
Copy link
Member

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()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done! Thank for reviewing 👍

@hoangnam2261
Copy link
Contributor Author

Hi @akarnokd, i am done all for requesting changes.
Thank you so much for reviewing my code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants