The program has the next code:
public class RxTaskHandler<T> implements OnSuccessListener<T>{
public RxTaskHandler(MaybeEmitter<T> emitter){
this.emitter = emitter;
}
public static void assignTask(MaybeEmitter<T> emitter){
RxTaskHandler rxTaskHandler = new RxTaskHandler(emitter);
task.addOnSuccessListenerr(rxTaskHandler);
}
@Override
public void onSuccess(Object o) {
emitter.onNext();
}
}
The question about this line - task.addOnSuccessListenerr(rxTaskHandler). We must add OnSuccessListener interface, but instead of this we add the instance of the class which implements OnSuccessListener. It means we can replace instance of the class (implements necessary interface) by instance of the interface?