-
Notifications
You must be signed in to change notification settings - Fork 7.6k
clarify behaviour of groupBy in javadoc #3584
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
Conversation
882fcde
to
75ad008
Compare
Corrected the documentation that said resubscription occurs when it is rather a new GroupedObservable is emittted for a group. |
75ad008
to
dd40e79
Compare
@@ -5577,14 +5577,16 @@ public final void forEach(final Action1<? super T> onNext, final Action1<Throwab | |||
|
|||
/** | |||
* Groups the items emitted by an {@code Observable} according to a specified criterion, and emits these | |||
* grouped items as {@link GroupedObservable}s, one {@code GroupedObservable} per group. | |||
* grouped items as {@link GroupedObservable}s. If a {@code GroupedObservable} | |||
* terminates before the source terminates then the next emission by the source with the same key as the |
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.
GroupedObservable allows only a single Subscriber during its lifetime and if this Subscriber unsubscribes before the main source terminates, the next emission by the main source having the same key will trigger a new GroupedObservable emission.
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.
Thanks @akarnokd, that does add information. I'll use that.
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 notice that GroupedObservable itself doesn't have a single Subscriber restriction but certainly the GroupedObservable emitted by groupBy does have this property. I'll rejig the wording to get this across.
dd40e79
to
da99a5e
Compare
Incorporated @akarnokd suggestion |
👍 |
👍
By the way, |
clarify behaviour of groupBy in javadoc
As discussed in #3411, some clarification of the behaviour of
groupBy
looks necessary re its behaviour when theGroupedObservable
terminates early (for example has.first()
applied to it). See also #3581.I also took the liberty of recommending
ignoreElements
instead oftake(0)
for the section in the javadoc that recommends how to ignore emissions because thetake(0)
approach would have more overhead (every emission from source would prompt the emission of a newGroupedObservable
) than theignoreElements
approach.Once this is accepted I'll look to submit a PR with
groupByOnce
(mentioned in #3411).