Skip to content

2.x: add more Maybe operators, fix a few javadoc mistakes #4467

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

Merged
merged 1 commit into from
Sep 2, 2016

Conversation

akarnokd
Copy link
Member

@akarnokd akarnokd commented Sep 2, 2016

  • Move verifyPositive into ObjectHelper
  • Fix javadoc of Flowable.subscribe() and Observable.subscribe() mentioning Subscription from 1.x
  • Maybe: add amb, concat, concatArray, merge, mergeArray, concatMap, subscribe, subscribeWith, doOnEvent

@codecov-io
Copy link

codecov-io commented Sep 2, 2016

Current coverage is 76.00% (diff: 83.80%)

Merging #4467 into 2.x will increase coverage by 0.10%

@@                2.x      #4467   diff @@
==========================================
  Files           485        493     +8   
  Lines         33042      33546   +504   
  Methods           0          0          
  Messages          0          0          
  Branches       5240       5310    +70   
==========================================
+ Hits          25079      25496   +417   
- Misses         5920       5983    +63   
- Partials       2043       2067    +24   

Powered by Codecov. Last update 88fafd8...d5bd37a

@@ -231,7 +231,7 @@ public static int bufferSize() {
public static <T, R> Flowable<R> combineLatest(Publisher<? extends T>[] sources, Function<Object[], ? extends R> combiner, int bufferSize) {
ObjectHelper.requireNonNull(sources, "sources is null");
ObjectHelper.requireNonNull(combiner, "combiner is null");
verifyPositive(bufferSize, "bufferSize");
ObjectHelper.verifyPositive(bufferSize, "bufferSize");
Copy link
Contributor

Choose a reason for hiding this comment

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

👍 thanks!

@JakeWharton
Copy link
Contributor

👍

@akarnokd akarnokd merged commit b15df98 into ReactiveX:2.x Sep 2, 2016
@akarnokd akarnokd deleted the MaybeOps902_1 branch September 2, 2016 16:04
* @param onEvent the callback to call with the terminal event tuple
* @return the new Maybe instance
*/
public final Maybe<T> doOnEvent(BiConsumer<? super T, ? super Throwable> onEvent) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure this is any more ergonomic than doOnEach with a Notification. Will Single and Completable be getting doOnEach or this doOnEvent method?

Copy link
Member Author

Choose a reason for hiding this comment

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

Wasn't @vanniktech doing something like this for the others?

Copy link
Contributor

Choose a reason for hiding this comment

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

It feels weird to use null as such a strong signal where it's forbidden in most (all?) of the API. Not only do I prefer the readability that Notification's methods provide, but it would allow the re-use of side-effecting operations (such as logging) across all stream types since they all would have the same signature.

Copy link
Member Author

Choose a reason for hiding this comment

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

This is allocation free right now, Notification.createOnNext allocates. You can have a utility function that turns a Consumer<Notification<T>> into this BiConsumer but you can't un-allocate a Notification the other way around.

Copy link
Contributor

Choose a reason for hiding this comment

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

But by that argument we should remove doOnEach from Observable and Flowable as well in favor of a method with this signature. At least then there'd be parity for peeking across all stream types.

I would much prefer a doOnEach in all the stream types and force those who really need zero allocation peeking to just do a lift or use the doOnEach overload which accepts individual Consumers.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm doing coverage improvement right now on Flowable and Observable but after it, I encourage you to post a PR with your suggestions.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yup I'll also add those methods to RxJava 2 on Monday

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

Successfully merging this pull request may close these issues.

4 participants