The Subscriber has onNext(), onError(), onComplete(), and onSubscribe() methods which get a callback on the arrival of their respective events. We already have discussed the Subscriber creations in Chapter 4, Reactive Types in RxJava, and created many subscribers such as DefaultSubscriber, DisposableSubscriber, and ResourceSubscriber. If you want, you can refer to the chapter.
Now let's create a Subscriber as shown next:
class DemoSubscriber implements Subscriber<Long> { List<Long>items=new ArrayList(); public List<Long> getItems() { return items; } @Override public void onComplete() { // TODO Auto-generated method stub System.out.println("Its Done!!!"); } @Override public void onError(Throwable throwable) { // TODO Auto-generated...