@@ -275,38 +275,38 @@ public static Completable error(final Throwable error) {
275
275
return new CompletableError (error );
276
276
}
277
277
278
+
278
279
/**
279
- * Returns a Completable which when subscribed, executes the callable function, ignores its
280
- * normal result and emits onError or onCompleted only .
280
+ * Returns a Completable instance that runs the given Action for each subscriber and
281
+ * emits either an unchecked exception or simply completes .
281
282
* <dl>
282
283
* <dt><b>Scheduler:</b></dt>
283
- * <dd>{@code fromCallable } does not operate by default on a particular {@link Scheduler}.</dd>
284
+ * <dd>{@code fromAction } does not operate by default on a particular {@link Scheduler}.</dd>
284
285
* </dl>
285
- * @param callable the callable instance to execute for each subscriber
286
+ * @param run the runnable to run for each subscriber
286
287
* @return the new Completable instance
288
+ * @throws NullPointerException if run is null
287
289
*/
288
290
@ SchedulerSupport (SchedulerSupport .NONE )
289
- public static Completable fromCallable (final Callable <?> callable ) {
290
- Objects .requireNonNull (callable , "callable is null" );
291
- return new CompletableFromCallable ( callable );
291
+ public static Completable fromAction (final Action run ) {
292
+ Objects .requireNonNull (run , "run is null" );
293
+ return new CompletableFromAction ( run );
292
294
}
293
-
295
+
294
296
/**
295
- * Returns a Completable instance that subscribes to the given publisher , ignores all values and
296
- * emits only the terminal event .
297
+ * Returns a Completable which when subscribed, executes the callable function , ignores its
298
+ * normal result and emits onError or onCompleted only .
297
299
* <dl>
298
300
* <dt><b>Scheduler:</b></dt>
299
- * <dd>{@code fromPublisher } does not operate by default on a particular {@link Scheduler}.</dd>
301
+ * <dd>{@code fromCallable } does not operate by default on a particular {@link Scheduler}.</dd>
300
302
* </dl>
301
- * @param <T> the type of the publisher
302
- * @param publisher the Publisher instance to subscribe to, not null
303
+ * @param callable the callable instance to execute for each subscriber
303
304
* @return the new Completable instance
304
- * @throws NullPointerException if publisher is null
305
305
*/
306
306
@ SchedulerSupport (SchedulerSupport .NONE )
307
- public static < T > Completable fromPublisher (final Publisher < T > publisher ) {
308
- Objects .requireNonNull (publisher , "publisher is null" );
309
- return new CompletableFromPublisher < T >( publisher );
307
+ public static Completable fromCallable (final Callable <?> callable ) {
308
+ Objects .requireNonNull (callable , "callable is null" );
309
+ return new CompletableFromCallable ( callable );
310
310
}
311
311
312
312
/**
@@ -349,25 +349,25 @@ public static <T> Completable fromObservable(final ObservableSource<T> observabl
349
349
Objects .requireNonNull (observable , "observable is null" );
350
350
return new CompletableFromObservable <T >(observable );
351
351
}
352
-
353
352
354
353
/**
355
- * Returns a Completable instance that runs the given Runnable for each subscriber and
356
- * emits either an unchecked exception or simply completes .
354
+ * Returns a Completable instance that subscribes to the given publisher, ignores all values and
355
+ * emits only the terminal event .
357
356
* <dl>
358
357
* <dt><b>Scheduler:</b></dt>
359
- * <dd>{@code fromRunnable } does not operate by default on a particular {@link Scheduler}.</dd>
358
+ * <dd>{@code fromPublisher } does not operate by default on a particular {@link Scheduler}.</dd>
360
359
* </dl>
361
- * @param run the runnable to run for each subscriber
360
+ * @param <T> the type of the publisher
361
+ * @param publisher the Publisher instance to subscribe to, not null
362
362
* @return the new Completable instance
363
- * @throws NullPointerException if run is null
363
+ * @throws NullPointerException if publisher is null
364
364
*/
365
365
@ SchedulerSupport (SchedulerSupport .NONE )
366
- public static Completable fromRunnable (final Runnable run ) {
367
- Objects .requireNonNull (run , "run is null" );
368
- return new CompletableFromRunnable ( run );
366
+ public static < T > Completable fromPublisher (final Publisher < T > publisher ) {
367
+ Objects .requireNonNull (publisher , "publisher is null" );
368
+ return new CompletableFromPublisher < T >( publisher );
369
369
}
370
-
370
+
371
371
/**
372
372
* Returns a Completable instance that when subscribed to, subscribes to the Single instance and
373
373
* emits a completion event if the single emits onSuccess or forwards any onError events.
@@ -944,10 +944,10 @@ public final Completable delay(final long delay, final TimeUnit unit, final Sche
944
944
* @throws NullPointerException if onComplete is null
945
945
*/
946
946
@ SchedulerSupport (SchedulerSupport .NONE )
947
- public final Completable doOnComplete (Runnable onComplete ) {
947
+ public final Completable doOnComplete (Action onComplete ) {
948
948
return doOnLifecycle (Functions .emptyConsumer (), Functions .emptyConsumer (),
949
- onComplete , Functions .EMPTY_RUNNABLE ,
950
- Functions .EMPTY_RUNNABLE , Functions .EMPTY_RUNNABLE );
949
+ onComplete , Functions .EMPTY_ACTION ,
950
+ Functions .EMPTY_ACTION , Functions .EMPTY_ACTION );
951
951
}
952
952
953
953
/**
@@ -962,10 +962,10 @@ public final Completable doOnComplete(Runnable onComplete) {
962
962
* @throws NullPointerException if onDispose is null
963
963
*/
964
964
@ SchedulerSupport (SchedulerSupport .NONE )
965
- public final Completable doOnDispose (Runnable onDispose ) {
965
+ public final Completable doOnDispose (Action onDispose ) {
966
966
return doOnLifecycle (Functions .emptyConsumer (), Functions .emptyConsumer (),
967
- Functions .EMPTY_RUNNABLE , Functions .EMPTY_RUNNABLE ,
968
- Functions .EMPTY_RUNNABLE , onDispose );
967
+ Functions .EMPTY_ACTION , Functions .EMPTY_ACTION ,
968
+ Functions .EMPTY_ACTION , onDispose );
969
969
}
970
970
971
971
/**
@@ -981,8 +981,8 @@ public final Completable doOnDispose(Runnable onDispose) {
981
981
@ SchedulerSupport (SchedulerSupport .NONE )
982
982
public final Completable doOnError (Consumer <? super Throwable > onError ) {
983
983
return doOnLifecycle (Functions .emptyConsumer (), onError ,
984
- Functions .EMPTY_RUNNABLE , Functions .EMPTY_RUNNABLE ,
985
- Functions .EMPTY_RUNNABLE , Functions .EMPTY_RUNNABLE );
984
+ Functions .EMPTY_ACTION , Functions .EMPTY_ACTION ,
985
+ Functions .EMPTY_ACTION , Functions .EMPTY_ACTION );
986
986
}
987
987
988
988
/**
@@ -1003,10 +1003,10 @@ public final Completable doOnError(Consumer<? super Throwable> onError) {
1003
1003
private Completable doOnLifecycle (
1004
1004
final Consumer <? super Disposable > onSubscribe ,
1005
1005
final Consumer <? super Throwable > onError ,
1006
- final Runnable onComplete ,
1007
- final Runnable onTerminate ,
1008
- final Runnable onAfterTerminate ,
1009
- final Runnable onDisposed ) {
1006
+ final Action onComplete ,
1007
+ final Action onTerminate ,
1008
+ final Action onAfterTerminate ,
1009
+ final Action onDisposed ) {
1010
1010
Objects .requireNonNull (onSubscribe , "onSubscribe is null" );
1011
1011
Objects .requireNonNull (onError , "onError is null" );
1012
1012
Objects .requireNonNull (onComplete , "onComplete is null" );
@@ -1030,8 +1030,8 @@ private Completable doOnLifecycle(
1030
1030
@ SchedulerSupport (SchedulerSupport .NONE )
1031
1031
public final Completable doOnSubscribe (Consumer <? super Disposable > onSubscribe ) {
1032
1032
return doOnLifecycle (onSubscribe , Functions .emptyConsumer (),
1033
- Functions .EMPTY_RUNNABLE , Functions .EMPTY_RUNNABLE ,
1034
- Functions .EMPTY_RUNNABLE , Functions .EMPTY_RUNNABLE );
1033
+ Functions .EMPTY_ACTION , Functions .EMPTY_ACTION ,
1034
+ Functions .EMPTY_ACTION , Functions .EMPTY_ACTION );
1035
1035
}
1036
1036
1037
1037
/**
@@ -1045,10 +1045,10 @@ public final Completable doOnSubscribe(Consumer<? super Disposable> onSubscribe)
1045
1045
* @return the new Completable instance
1046
1046
*/
1047
1047
@ SchedulerSupport (SchedulerSupport .NONE )
1048
- public final Completable doOnTerminate (final Runnable onTerminate ) {
1048
+ public final Completable doOnTerminate (final Action onTerminate ) {
1049
1049
return doOnLifecycle (Functions .emptyConsumer (), Functions .emptyConsumer (),
1050
- Functions .EMPTY_RUNNABLE , onTerminate ,
1051
- Functions .EMPTY_RUNNABLE , Functions .EMPTY_RUNNABLE );
1050
+ Functions .EMPTY_ACTION , onTerminate ,
1051
+ Functions .EMPTY_ACTION , Functions .EMPTY_ACTION );
1052
1052
}
1053
1053
1054
1054
/**
@@ -1062,10 +1062,10 @@ public final Completable doOnTerminate(final Runnable onTerminate) {
1062
1062
* @return the new Completable instance
1063
1063
*/
1064
1064
@ SchedulerSupport (SchedulerSupport .NONE )
1065
- public final Completable doAfterTerminate (final Runnable onAfterTerminate ) {
1065
+ public final Completable doAfterTerminate (final Action onAfterTerminate ) {
1066
1066
return doOnLifecycle (Functions .emptyConsumer (), Functions .emptyConsumer (),
1067
- onAfterTerminate , Functions .EMPTY_RUNNABLE ,
1068
- Functions .EMPTY_RUNNABLE , Functions .EMPTY_RUNNABLE );
1067
+ onAfterTerminate , Functions .EMPTY_ACTION ,
1068
+ Functions .EMPTY_ACTION , Functions .EMPTY_ACTION );
1069
1069
}
1070
1070
1071
1071
/**
@@ -1414,7 +1414,7 @@ public final void subscribe(CompletableObserver s) {
1414
1414
* @throws NullPointerException if either callback is null
1415
1415
*/
1416
1416
@ SchedulerSupport (SchedulerSupport .NONE )
1417
- public final Disposable subscribe (final Runnable onComplete , final Consumer <? super Throwable > onError ) {
1417
+ public final Disposable subscribe (final Action onComplete , final Consumer <? super Throwable > onError ) {
1418
1418
Objects .requireNonNull (onError , "onError is null" );
1419
1419
Objects .requireNonNull (onComplete , "onComplete is null" );
1420
1420
@@ -1443,7 +1443,7 @@ public final <T> void subscribe(final Observer<? super T> observer) {
1443
1443
}
1444
1444
1445
1445
/**
1446
- * Subscribes to this Completable and calls the given Runnable when this Completable
1446
+ * Subscribes to this Completable and calls the given Action when this Completable
1447
1447
* completes normally.
1448
1448
* <p>
1449
1449
* If this Completable emits an error, it is sent to RxJavaPlugins.onError and gets swallowed.
@@ -1455,7 +1455,7 @@ public final <T> void subscribe(final Observer<? super T> observer) {
1455
1455
* @return the Disposable that allows cancelling the subscription
1456
1456
*/
1457
1457
@ SchedulerSupport (SchedulerSupport .NONE )
1458
- public final Disposable subscribe (final Runnable onComplete ) {
1458
+ public final Disposable subscribe (final Action onComplete ) {
1459
1459
Objects .requireNonNull (onComplete , "onComplete is null" );
1460
1460
1461
1461
CallbackCompletableObserver s = new CallbackCompletableObserver (onComplete );
0 commit comments