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

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

本文整理了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

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

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

@Override
  public Flowable<Integer> apply(Integer t) {
    return Flowable.just(t).hide();
  }
};

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

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

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

@Override
  public Flowable<Integer> apply(Integer t) {
    return Flowable.range(1, Flowable.bufferSize() * 2)
        .doOnNext(new Consumer<Integer>() {
          @Override
          public void accept(Integer t) {
            count.getAndIncrement();
          }
        }).hide();
  }
}).subscribe(ts);

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

@Test
public void mapperThrows() {
  Flowable.just(1).hide()
  .switchMap(new Function<Integer, Flowable<Object>>() {
    @Override
    public Flowable<Object> apply(Integer v) throws Exception {
      throw new TestException();
    }
  })
  .test()
  .assertFailure(TestException.class);
}

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

@Test
public void innerError() {
  Flowable.<Integer>just(1).hide().concatMapEager(new Function<Integer, Flowable<Integer>>() {
    @Override
    public Flowable<Integer> apply(Integer v) throws Exception {
      return Flowable.error(new TestException());
    }
  })
  .test()
  .assertFailure(TestException.class);
}

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

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

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

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

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

@Test
public void innerErrorMaxConcurrency() {
  Flowable.<Integer>just(1).hide().concatMapEager(new Function<Integer, Flowable<Integer>>() {
    @Override
    public Flowable<Integer> apply(Integer v) throws Exception {
      return Flowable.error(new TestException());
    }
  }, 1, 128)
  .test()
  .assertFailure(TestException.class);
}

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

@Test
public void innerLong() {
  int n = Flowable.bufferSize() * 2;
  Flowable.just(1).hide()
  .concatMapEager(Functions.justFunction(Flowable.range(1, n).hide()))
  .rebatchRequests(1)
  .test()
  .assertValueCount(n)
  .assertComplete()
  .assertNoErrors();
}

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

@Test
public void mergeScalar2() {
  Flowable.merge(Flowable.just(Flowable.just(1)).hide())
  .test()
  .assertResult(1);
}

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

@Test
public void unboundedIn() {
  Completable.concat(Flowable.just(Completable.complete()).hide(), Integer.MAX_VALUE)
  .test()
  .assertResult();
}

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

@Test
public void mergeScalarEmpty() {
  Flowable.merge(Flowable.just(Flowable.empty()).hide())
  .test()
  .assertResult();
}

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

@Test
public void workerNotDisposedPrematurelyNormalInNormalOut() {
  DisposeTrackingScheduler s = new DisposeTrackingScheduler();
  Flowable.concat(
      Flowable.just(1).hide().observeOn(s),
      Flowable.just(2)
  )
  .test()
  .assertResult(1, 2);
  assertEquals(1, s.disposedCount.get());
}

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

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

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

@Test
public void callableCrash() {
  Flowable.just(1).hide()
  .concatMap(Functions.justFunction(Flowable.fromCallable(new Callable<Object>() {
    @Override
    public Object call() throws Exception {
      throw new TestException();
    }
  })))
  .test()
  .assertFailure(TestException.class);
}

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

@Test
public void concatMapEmpty() {
  Flowable.just(1).hide()
  .concatMap(Functions.justFunction(Flowable.empty()))
  .test()
  .assertResult();
}

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

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

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

@Test
public void doubleObserveOn() {
  Flowable.just(1).hide()
  .observeOn(Schedulers.computation())
  .observeOn(Schedulers.single())
  .test()
  .awaitDone(5, TimeUnit.SECONDS)
  .assertResult(1);
}

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

@Test
public void cancelBeforeActualSubscribe() {
  TestScheduler test = new TestScheduler();
  TestSubscriber<Integer> ts = Flowable.just(1).hide()
      .subscribeOn(test).test(Long.MAX_VALUE, true);
  test.advanceTimeBy(1, TimeUnit.SECONDS);
  ts
  .assertSubscribed()
  .assertNoValues()
  .assertNotTerminated();
}

相关文章

Flowable类方法