本文整理了Java中io.reactivex.Observable.hide()
方法的一些代码示例,展示了Observable.hide()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Observable.hide()
方法的具体详情如下:
包路径:io.reactivex.Observable
类名称:Observable
方法名:hide
[英]Hides the identity of this Observable and its Disposable.
Allows hiding extra features such as io.reactivex.subjects.Subject's Observer methods or preventing certain identity-based optimizations (fusion).
Scheduler: hide does not operate by default on a particular Scheduler.
[中]隐藏了这个可观察到的和它的一次性的身份。
允许隐藏io等额外功能。reactivex。学科。受试者的观察方法或防止某些基于身份的优化(融合)。
调度程序:默认情况下,隐藏不会在特定调度程序上运行。
代码示例来源:origin: ReactiveX/RxJava
@Override
public Observable<Integer> apply(Integer t) {
return Observable.just(t).hide();
}
};
代码示例来源:origin: ReactiveX/RxJava
@Override
public Observable<Integer> apply(Integer t) {
Observable<Integer> r = Observable.just(t);
if (rnd.nextBoolean()) {
r = r.hide();
}
return r;
}
})
代码示例来源:origin: ReactiveX/RxJava
@Test
public void dispose() {
TestHelper.checkDisposed(Observable.switchOnNext(
Observable.just(Observable.just(1)).hide()));
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void innerErrorMaxConcurrency() {
Observable.<Integer>just(1).hide().concatMapEager(new Function<Integer, ObservableSource<Integer>>() {
@Override
public ObservableSource<Integer> apply(Integer v) throws Exception {
return Observable.error(new TestException());
}
}, 1, 128)
.test()
.assertFailure(TestException.class);
}
代码示例来源:origin: ReactiveX/RxJava
@Override
public Observable<Integer> apply(Integer t) {
return Observable.range(1, Observable.bufferSize() * 2)
.doOnNext(new Consumer<Integer>() {
@Override
public void accept(Integer t) {
count.getAndIncrement();
}
}).hide();
}
}).subscribe(to);
代码示例来源:origin: ReactiveX/RxJava
@Test
public void mapperThrowsDelayError() {
Observable.just(1).hide()
.concatMapDelayError(new Function<Integer, ObservableSource<Integer>>() {
@Override
public ObservableSource<Integer> apply(Integer v) throws Exception {
throw new TestException();
}
})
.test()
.assertFailure(TestException.class);
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void innerError() {
Observable.<Integer>just(1).hide().concatMapEager(new Function<Integer, ObservableSource<Integer>>() {
@Override
public ObservableSource<Integer> apply(Integer v) throws Exception {
return Observable.error(new TestException());
}
})
.test()
.assertFailure(TestException.class);
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void mapperThrows() {
Observable.just(1).hide()
.concatMap(new Function<Integer, ObservableSource<Integer>>() {
@Override
public ObservableSource<Integer> apply(Integer v) throws Exception {
throw new TestException();
}
})
.test()
.assertFailure(TestException.class);
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void justHidden() {
Observable.just(1)
.hide()
.doAfterNext(afterNext)
.subscribeWith(to)
.assertResult(1);
assertEquals(Arrays.asList(1, -1), values);
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void innerError() {
Observable.<Integer>just(1).hide()
.concatMapCompletable(completableError())
.test()
.assertFailure(TestException.class);
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void mapperThrows() {
Observable.just(1).hide()
.concatMapCompletable(completableThrows())
.test()
.assertFailure(TestException.class);
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void mergeScalarError() {
Observable.merge(Observable.just(Observable.fromCallable(new Callable<Object>() {
@Override
public Object call() throws Exception {
throw new TestException();
}
})).hide())
.test()
.assertFailure(TestException.class);
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void disposed() {
TestHelper.checkDisposed(Observable.just(1).hide()
.concatMapMaybe(Functions.justFunction(Maybe.never()))
);
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void disposed() {
TestHelper.checkDisposed(Observable.just(1).hide()
.concatMapSingle(Functions.justFunction(Single.never()))
);
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void mergeScalarEmpty() {
Observable.merge(Observable.just(Observable.empty()).hide())
.test()
.assertResult();
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void outputFused() {
TestObserver<Integer> to = ObserverFusion.newTest(QueueFuseable.ANY);
Observable.range(1, 5).hide()
.observeOn(Schedulers.single())
.subscribe(to);
ObserverFusion.assertFusion(to, QueueFuseable.ASYNC)
.awaitDone(5, TimeUnit.SECONDS)
.assertResult(1, 2, 3, 4, 5);
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void outputFusedReject() {
TestObserver<Integer> to = ObserverFusion.newTest(QueueFuseable.SYNC);
Observable.range(1, 5).hide()
.observeOn(Schedulers.single())
.subscribe(to);
ObserverFusion.assertFusion(to, QueueFuseable.NONE)
.awaitDone(5, TimeUnit.SECONDS)
.assertResult(1, 2, 3, 4, 5);
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void syncIterableHidden() {
Observable.fromIterable(Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10))
.hide()
.to(ObserverFusion.<Integer>test(QueueFuseable.ANY, false))
.assertOf(ObserverFusion.<Integer>assertNotFuseable())
.assertOf(ObserverFusion.<Integer>assertFusionMode(QueueFuseable.NONE))
.assertValues(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
.assertNoErrors()
.assertComplete();
}
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void syncFusedCompletable() {
Observable.range(1, 5).hide()
.switchMap(Functions.justFunction(
Completable.complete().toObservable()
))
.test()
.assertResult();
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void syncFusedMaybe() {
Observable.range(1, 5).hide()
.switchMap(Functions.justFunction(
Maybe.just(1).toObservable()
))
.test()
.assertResult(1, 1, 1, 1, 1);
}
内容来源于网络,如有侵权,请联系作者删除!