Skip to content

Commit 1fbc44f

Browse files
authored
2.x: Reword the just() operator and reference other typical alternatives (#5830)
* 2.x: Reword the just() operator and reference other typical alternatives * Fix a/an
1 parent 421b9a4 commit 1fbc44f

File tree

2 files changed

+22
-14
lines changed

2 files changed

+22
-14
lines changed

src/main/java/io/reactivex/Flowable.java

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2458,17 +2458,17 @@ public static Flowable<Long> intervalRange(long start, long count, long initialD
24582458
}
24592459

24602460
/**
2461-
* Returns a Flowable that emits a single item and then completes.
2461+
* Returns a Flowable that signals the given (constant reference) item and then completes.
24622462
* <p>
24632463
* <img width="640" height="310" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/just.png" alt="">
24642464
* <p>
2465-
* To convert any object into a Publisher that emits that object, pass that object into the {@code just}
2466-
* method.
2465+
* Note that the item is taken and re-emitted as is and not computed by any means by {@code just}. Use {@link #fromCallable(Callable)}
2466+
* to generate a single item on demand (when {@code Subscriber}s subscribe to it).
2467+
* <p>
2468+
* See the multi-parameter overloads of {@code just} to emit more than one (constant reference) items one after the other.
2469+
* Use {@link #fromArray(Object...)} to emit an arbitrary number of items that are known upfront.
24672470
* <p>
2468-
* This is similar to the {@link #fromArray(java.lang.Object[])} method, except that {@code from} will convert
2469-
* an {@link Iterable} object into a Publisher that emits each of the items in the Iterable, one at a
2470-
* time, while the {@code just} method converts an Iterable into a Publisher that emits the entire
2471-
* Iterable as a single item.
2471+
* To emit the items of an {@link Iterable} sequence (such as a {@link java.util.List}), use {@link #fromIterable(Iterable)}.
24722472
* <dl>
24732473
* <dt><b>Backpressure:</b></dt>
24742474
* <dd>The operator honors backpressure from downstream.</dd>
@@ -2482,6 +2482,10 @@ public static Flowable<Long> intervalRange(long start, long count, long initialD
24822482
* the type of that item
24832483
* @return a Flowable that emits {@code value} as a single item and then completes
24842484
* @see <a href="http://reactivex.io/documentation/operators/just.html">ReactiveX operators documentation: Just</a>
2485+
* @see #just(Object, Object)
2486+
* @see #fromCallable(Callable)
2487+
* @see #fromArray(Object...)
2488+
* @see #fromIterable(Iterable)
24852489
*/
24862490
@CheckReturnValue
24872491
@BackpressureSupport(BackpressureKind.FULL)

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

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2234,17 +2234,17 @@ public static Observable<Long> intervalRange(long start, long count, long initia
22342234
}
22352235

22362236
/**
2237-
* Returns an Observable that emits a single item and then completes.
2237+
* Returns an Observable that signals the given (constant reference) item and then completes.
22382238
* <p>
22392239
* <img width="640" height="290" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/just.item.png" alt="">
22402240
* <p>
2241-
* To convert any object into an ObservableSource that emits that object, pass that object into the {@code just}
2242-
* method.
2241+
* Note that the item is taken and re-emitted as is and not computed by any means by {@code just}. Use {@link #fromCallable(Callable)}
2242+
* to generate a single item on demand (when {@code Observer}s subscribe to it).
2243+
* <p>
2244+
* See the multi-parameter overloads of {@code just} to emit more than one (constant reference) items one after the other.
2245+
* Use {@link #fromArray(Object...)} to emit an arbitrary number of items that are known upfront.
22432246
* <p>
2244-
* This is similar to the {@link #fromArray(java.lang.Object[])} method, except that {@code from} will convert
2245-
* an {@link Iterable} object into an ObservableSource that emits each of the items in the Iterable, one at a
2246-
* time, while the {@code just} method converts an Iterable into an ObservableSource that emits the entire
2247-
* Iterable as a single item.
2247+
* To emit the items of an {@link Iterable} sequence (such as a {@link java.util.List}), use {@link #fromIterable(Iterable)}.
22482248
* <dl>
22492249
* <dt><b>Scheduler:</b></dt>
22502250
* <dd>{@code just} does not operate by default on a particular {@link Scheduler}.</dd>
@@ -2256,6 +2256,10 @@ public static Observable<Long> intervalRange(long start, long count, long initia
22562256
* the type of that item
22572257
* @return an Observable that emits {@code value} as a single item and then completes
22582258
* @see <a href="http://reactivex.io/documentation/operators/just.html">ReactiveX operators documentation: Just</a>
2259+
* @see #just(Object, Object)
2260+
* @see #fromCallable(Callable)
2261+
* @see #fromArray(Object...)
2262+
* @see #fromIterable(Iterable)
22592263
*/
22602264
@CheckReturnValue
22612265
@SchedulerSupport(SchedulerSupport.NONE)

0 commit comments

Comments
 (0)