I have a question about the disposal on RxJava. I found this below sentence on RxSwift document on Github.
When a sequence sends the
completed
Yes, all associated resources will be disposed automatically. To illustrate run following test with RxJava 2:
boolean isDisposed = false;
@Test
public void testDisposed(){
TestObserver<Integer> to = Observable.<Integer>create(subscriber -> {
subscriber.setDisposable(new Disposable() {
@Override
public boolean isDisposed() {
return isDisposed;
}
@Override
public void dispose() {
isDisposed = true;
}
});
subscriber.onComplete();
}).test();
to.assertComplete();
assertTrue(isDisposed);
}