IgnoreElements
do not emit any items from an Observable but mirror its termination notification
The IgnoreElements operator suppresses all of the items emitted by the source Observable, but allows its termination notification (either
onError
or onCompleted
) to pass through unchanged.
If you do not care about the items being emitted by an Observable, but you do want to be notified when it completes or when it terminates with an error, you can apply the
ignoreElements
operator to the Observable, which will ensure that it will never call its observers’ onNext
handlers.
---------------------------------------------------------------------------
Observable.just(list2).ignoreElements()
.subscribe(System.out::println);
--------------------------------------------------------------------------
22
No comments:
Post a Comment