Subscriber是一个抽象类,提供观察员界面

因为Subscription接口方法已经由Subscriber实现,所以只需要实现ObserverT接口

@ overridepublicfinalvoidunsubscribe () { subscriptions.unsubscribe ); }/* * * indicateswhetherthissubscriberhasunsubscribedfromitslistofsubscriptions.* * @ return { @ code true } ifthisssubscribribribstions { @ code false } otherwise */@ overridepublicfinalbooleanisunsubscribed }请看我们的演示

subscriberstringmysubscriber=newsubscriberstring ({ @ overridepublicvoidonnext (strings ) system.out.println ) ) s ) } @ overridepublicvoidoncompleted ({ } @ overridepublicvoidonerror ) throwablee ) };