Skip to content

Commit b087eff

Browse files
committed
Merge pull request #3584 from davidmoten/group-by-javadoc
clarify behaviour of groupBy in javadoc
2 parents 52a7e49 + da99a5e commit b087eff

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/main/java/rx/Observable.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5577,14 +5577,17 @@ public final void forEach(final Action1<? super T> onNext, final Action1<Throwab
55775577

55785578
/**
55795579
* Groups the items emitted by an {@code Observable} according to a specified criterion, and emits these
5580-
* grouped items as {@link GroupedObservable}s, one {@code GroupedObservable} per group.
5580+
* grouped items as {@link GroupedObservable}s. The emitted {@code GroupedObservable} allows only a single
5581+
* {@link Subscriber} during its lifetime and if this {@code Subscriber} unsubscribes before the
5582+
* source terminates, the next emission by the source having the same key will trigger a new
5583+
* {@code GroupedObservable} emission.
55815584
* <p>
55825585
* <img width="640" height="360" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/groupBy.png" alt="">
55835586
* <p>
55845587
* <em>Note:</em> A {@link GroupedObservable} will cache the items it is to emit until such time as it
55855588
* is subscribed to. For this reason, in order to avoid memory leaks, you should not simply ignore those
55865589
* {@code GroupedObservable}s that do not concern you. Instead, you can signal to them that they may
5587-
* discard their buffers by applying an operator like {@link #take}{@code (0)} to them.
5590+
* discard their buffers by applying an operator like {@link #ignoreElements} to them.
55885591
* <dl>
55895592
* <dt><b>Scheduler:</b></dt>
55905593
* <dd>{@code groupBy} does not operate by default on a particular {@link Scheduler}.</dd>
@@ -5609,14 +5612,17 @@ public final <K, R> Observable<GroupedObservable<K, R>> groupBy(final Func1<? su
56095612

56105613
/**
56115614
* Groups the items emitted by an {@code Observable} according to a specified criterion, and emits these
5612-
* grouped items as {@link GroupedObservable}s, one {@code GroupedObservable} per group.
5615+
* grouped items as {@link GroupedObservable}s. The emitted {@code GroupedObservable} allows only a single
5616+
* {@link Subscriber} during its lifetime and if this {@code Subscriber} unsubscribes before the
5617+
* source terminates, the next emission by the source having the same key will trigger a new
5618+
* {@code GroupedObservable} emission.
56135619
* <p>
56145620
* <img width="640" height="360" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/groupBy.png" alt="">
56155621
* <p>
56165622
* <em>Note:</em> A {@link GroupedObservable} will cache the items it is to emit until such time as it
56175623
* is subscribed to. For this reason, in order to avoid memory leaks, you should not simply ignore those
56185624
* {@code GroupedObservable}s that do not concern you. Instead, you can signal to them that they may
5619-
* discard their buffers by applying an operator like {@link #take}{@code (0)} to them.
5625+
* discard their buffers by applying an operator like {@link #ignoreElements} to them.
56205626
* <dl>
56215627
* <dt><b>Scheduler:</b></dt>
56225628
* <dd>{@code groupBy} does not operate by default on a particular {@link Scheduler}.</dd>

0 commit comments

Comments
 (0)