Skip to content

Commit cd6bc08

Browse files
VeskoIakarnokd
authored andcommitted
Fix a misleading documentation of Observable.singleElement() (#5668)
* Fix a misleading documentation of Observable.singleElement() * Reduce the first part of Observable.singleElement() JavaDoc to a single sentence. * Update the Marble diagram of Observable.singleElement()
1 parent 5387e20 commit cd6bc08

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/main/java/io/reactivex/Observable.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10277,11 +10277,10 @@ public final Observable<T> share() {
1027710277
}
1027810278

1027910279
/**
10280-
* Returns a Maybe that emits the single item emitted by this Observable if this Observable
10281-
* emits only a single item, otherwise if this Observable emits more than one item or no items, an
10282-
* {@code IllegalArgumentException} or {@code NoSuchElementException} is signalled respectively.
10280+
* Returns a Maybe that completes if this Observable is empty or emits the single item emitted by this Observable,
10281+
* or signals an {@code IllegalArgumentException} if this Observable emits more than one item.
1028310282
* <p>
10284-
* <img width="640" height="315" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/singleElement.png" alt="">
10283+
* <img width="640" height="217" src="https://raw.githubusercontent.com/wiki/ReactiveX/RxJava/images/rx-operators/singleElement.o.png" alt="">
1028510284
* <dl>
1028610285
* <dt><b>Scheduler:</b></dt>
1028710286
* <dd>{@code singleElement} does not operate by default on a particular {@link Scheduler}.</dd>

src/test/java/io/reactivex/internal/operators/observable/ObservableSingleTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,7 @@ public void testSingleWithEmpty() {
282282

283283
InOrder inOrder = inOrder(observer);
284284
inOrder.verify(observer).onComplete();
285+
inOrder.verify(observer, never()).onError(any(Throwable.class));
285286
inOrder.verifyNoMoreInteractions();
286287
}
287288

0 commit comments

Comments
 (0)