io.reactivex.Flowable.hide()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(5.3k)|赞(0)|评价(0)|浏览(163)

本文整理了Java中io.reactivex.Flowable.hide()方法的一些代码示例,展示了Flowable.hide()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Flowable.hide()方法的具体详情如下:
包路径:io.reactivex.Flowable
类名称:Flowable
方法名:hide

Flowable.hide介绍

[英]Hides the identity of this Flowable and its Subscription.

Allows hiding extra features such as Processor's Subscriber methods or preventing certain identity-based optimizations (fusion). Backpressure: The operator is a pass-through for backpressure, the behavior is determined by the upstream's backpressure behavior. Scheduler: hide does not operate by default on a particular Scheduler.
[中]隐藏此可流动项及其订阅的标识。
允许隐藏额外功能,如处理器的订户方法或防止某些基于身份的优化(融合)。背压:操作员是背压的传递,其行为由上游的背压行为决定。调度程序:默认情况下,隐藏不会在特定调度程序上运行。

代码示例

代码示例来源:origin: ReactiveX/RxJava

  1. @Override
  2. public Flowable<Long> apply(Long t) {
  3. return Flowable.fromIterable(Arrays.asList(1L, 2L, 3L)).hide();
  4. }
  5. }).take(3)).subscribe(ts);

代码示例来源:origin: ReactiveX/RxJava

  1. @Override
  2. public Flowable<Integer> apply(Integer t) {
  3. return Flowable.just(t).hide();
  4. }
  5. };

代码示例来源:origin: ReactiveX/RxJava

  1. @Override
  2. public Object apply(Flowable<Integer> f) throws Exception {
  3. return f.concatMap(Functions.justFunction(Flowable.just(1).hide()));
  4. }
  5. }, true, 1, 1, 1);

代码示例来源:origin: ReactiveX/RxJava

  1. @Override
  2. public Flowable<Integer> apply(Integer t) {
  3. return Flowable.range(1, Flowable.bufferSize() * 2)
  4. .doOnNext(new Consumer<Integer>() {
  5. @Override
  6. public void accept(Integer t) {
  7. count.getAndIncrement();
  8. }
  9. }).hide();
  10. }
  11. }).subscribe(ts);

代码示例来源:origin: ReactiveX/RxJava

  1. @Test
  2. public void mapperThrows() {
  3. Flowable.just(1).hide()
  4. .switchMap(new Function<Integer, Flowable<Object>>() {
  5. @Override
  6. public Flowable<Object> apply(Integer v) throws Exception {
  7. throw new TestException();
  8. }
  9. })
  10. .test()
  11. .assertFailure(TestException.class);
  12. }

代码示例来源:origin: ReactiveX/RxJava

  1. @Test
  2. public void innerError() {
  3. Flowable.<Integer>just(1).hide().concatMapEager(new Function<Integer, Flowable<Integer>>() {
  4. @Override
  5. public Flowable<Integer> apply(Integer v) throws Exception {
  6. return Flowable.error(new TestException());
  7. }
  8. })
  9. .test()
  10. .assertFailure(TestException.class);
  11. }

代码示例来源:origin: ReactiveX/RxJava

  1. @Test
  2. public void oneByOne() {
  3. Flowable.range(1, 3).hide()
  4. .flatMapIterable(Functions.justFunction(Arrays.asList(1)), 1)
  5. .rebatchRequests(1)
  6. .test()
  7. .assertResult(1, 1, 1);
  8. }

代码示例来源:origin: ReactiveX/RxJava

  1. @Test
  2. public void dispose() {
  3. TestHelper.checkDisposed(Flowable.switchOnNext(
  4. Flowable.just(Flowable.just(1)).hide()));
  5. }

代码示例来源:origin: ReactiveX/RxJava

  1. @Test
  2. public void innerErrorMaxConcurrency() {
  3. Flowable.<Integer>just(1).hide().concatMapEager(new Function<Integer, Flowable<Integer>>() {
  4. @Override
  5. public Flowable<Integer> apply(Integer v) throws Exception {
  6. return Flowable.error(new TestException());
  7. }
  8. }, 1, 128)
  9. .test()
  10. .assertFailure(TestException.class);
  11. }

代码示例来源:origin: ReactiveX/RxJava

  1. @Test
  2. public void innerLong() {
  3. int n = Flowable.bufferSize() * 2;
  4. Flowable.just(1).hide()
  5. .concatMapEager(Functions.justFunction(Flowable.range(1, n).hide()))
  6. .rebatchRequests(1)
  7. .test()
  8. .assertValueCount(n)
  9. .assertComplete()
  10. .assertNoErrors();
  11. }

代码示例来源:origin: ReactiveX/RxJava

  1. @Test
  2. public void mergeScalar2() {
  3. Flowable.merge(Flowable.just(Flowable.just(1)).hide())
  4. .test()
  5. .assertResult(1);
  6. }

代码示例来源:origin: ReactiveX/RxJava

  1. @Test
  2. public void unboundedIn() {
  3. Completable.concat(Flowable.just(Completable.complete()).hide(), Integer.MAX_VALUE)
  4. .test()
  5. .assertResult();
  6. }

代码示例来源:origin: ReactiveX/RxJava

  1. @Test
  2. public void mergeScalarEmpty() {
  3. Flowable.merge(Flowable.just(Flowable.empty()).hide())
  4. .test()
  5. .assertResult();
  6. }

代码示例来源:origin: ReactiveX/RxJava

  1. @Test
  2. public void workerNotDisposedPrematurelyNormalInNormalOut() {
  3. DisposeTrackingScheduler s = new DisposeTrackingScheduler();
  4. Flowable.concat(
  5. Flowable.just(1).hide().observeOn(s),
  6. Flowable.just(2)
  7. )
  8. .test()
  9. .assertResult(1, 2);
  10. assertEquals(1, s.disposedCount.get());
  11. }

代码示例来源:origin: ReactiveX/RxJava

  1. @Test
  2. public void concatMapScalarBackpressuredDelayError() {
  3. Flowable.just(1).hide()
  4. .concatMapDelayError(Functions.justFunction(Flowable.just(2)))
  5. .test(1L)
  6. .assertResult(2);
  7. }

代码示例来源:origin: ReactiveX/RxJava

  1. @Test
  2. public void callableCrash() {
  3. Flowable.just(1).hide()
  4. .concatMap(Functions.justFunction(Flowable.fromCallable(new Callable<Object>() {
  5. @Override
  6. public Object call() throws Exception {
  7. throw new TestException();
  8. }
  9. })))
  10. .test()
  11. .assertFailure(TestException.class);
  12. }

代码示例来源:origin: ReactiveX/RxJava

  1. @Test
  2. public void concatMapEmpty() {
  3. Flowable.just(1).hide()
  4. .concatMap(Functions.justFunction(Flowable.empty()))
  5. .test()
  6. .assertResult();
  7. }

代码示例来源:origin: ReactiveX/RxJava

  1. @Test
  2. public void syncIterableHidden() {
  3. Flowable.fromIterable(Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10))
  4. .hide()
  5. .to(SubscriberFusion.<Integer>test(Long.MAX_VALUE, QueueFuseable.ANY, false))
  6. .assertOf(SubscriberFusion.<Integer>assertNotFuseable())
  7. .assertOf(SubscriberFusion.<Integer>assertFusionMode(QueueFuseable.NONE))
  8. .assertValues(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
  9. .assertNoErrors()
  10. .assertComplete();
  11. }
  12. }

代码示例来源:origin: ReactiveX/RxJava

  1. @Test
  2. public void doubleObserveOn() {
  3. Flowable.just(1).hide()
  4. .observeOn(Schedulers.computation())
  5. .observeOn(Schedulers.single())
  6. .test()
  7. .awaitDone(5, TimeUnit.SECONDS)
  8. .assertResult(1);
  9. }

代码示例来源:origin: ReactiveX/RxJava

  1. @Test
  2. public void cancelBeforeActualSubscribe() {
  3. TestScheduler test = new TestScheduler();
  4. TestSubscriber<Integer> ts = Flowable.just(1).hide()
  5. .subscribeOn(test).test(Long.MAX_VALUE, true);
  6. test.advanceTimeBy(1, TimeUnit.SECONDS);
  7. ts
  8. .assertSubscribed()
  9. .assertNoValues()
  10. .assertNotTerminated();
  11. }

相关文章

Flowable类方法