io.reactivex.Observable.concatMapMaybeDelayError()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(4.4k)|赞(0)|评价(0)|浏览(139)

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

Observable.concatMapMaybeDelayError介绍

[英]Maps the upstream items into MaybeSources and subscribes to them one after the other terminates, emits their success value if available and delaying all errors till both this Observable and all inner MaybeSources terminate.

Scheduler: concatMapMaybeDelayError does not operate by default on a particular Scheduler.
[中]将上游项目映射到MaybeSources中,并一个接一个地订阅它们,如果可用,则发送它们的成功值,并延迟所有错误,直到该可观察到的和所有内部MaybeSources终止。
调度程序:默认情况下,concatMapMaybeDelayError不会在特定调度程序上运行。

代码示例

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

  1. /**
  2. * Maps the upstream items into {@link MaybeSource}s and subscribes to them one after the
  3. * other terminates, emits their success value if available and delaying all errors
  4. * till both this {@code Observable} and all inner {@code MaybeSource}s terminate.
  5. * <p>
  6. * <img width="640" height="305" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/concatMap.png" alt="">
  7. * <dl>
  8. * <dt><b>Scheduler:</b></dt>
  9. * <dd>{@code concatMapMaybeDelayError} does not operate by default on a particular {@link Scheduler}.</dd>
  10. * </dl>
  11. * <p>History: 2.1.11 - experimental
  12. * @param <R> the result type of the inner {@code MaybeSource}s
  13. * @param mapper the function called with the upstream item and should return
  14. * a {@code MaybeSource} to become the next source to
  15. * be subscribed to
  16. * @return a new Observable instance
  17. * @see #concatMapMaybe(Function)
  18. * @see #concatMapMaybeDelayError(Function, boolean)
  19. * @since 2.2
  20. */
  21. @CheckReturnValue
  22. @SchedulerSupport(SchedulerSupport.NONE)
  23. public final <R> Observable<R> concatMapMaybeDelayError(Function<? super T, ? extends MaybeSource<? extends R>> mapper) {
  24. return concatMapMaybeDelayError(mapper, true, 2);
  25. }

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

  1. @SchedulerSupport(SchedulerSupport.NONE)
  2. public final <R> Observable<R> concatMapMaybeDelayError(Function<? super T, ? extends MaybeSource<? extends R>> mapper, boolean tillTheEnd) {
  3. return concatMapMaybeDelayError(mapper, tillTheEnd, 2);

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

  1. @Override
  2. public Observable<Object> apply(Observable<Object> f)
  3. throws Exception {
  4. return f.concatMapMaybeDelayError(
  5. Functions.justFunction(Maybe.empty()));
  6. }
  7. }

代码示例来源:origin: redisson/redisson

  1. /**
  2. * Maps the upstream items into {@link MaybeSource}s and subscribes to them one after the
  3. * other terminates, emits their success value if available and delaying all errors
  4. * till both this {@code Observable} and all inner {@code MaybeSource}s terminate.
  5. * <p>
  6. * <img width="640" height="305" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/concatMap.png" alt="">
  7. * <dl>
  8. * <dt><b>Scheduler:</b></dt>
  9. * <dd>{@code concatMapMaybeDelayError} does not operate by default on a particular {@link Scheduler}.</dd>
  10. * </dl>
  11. * @param <R> the result type of the inner {@code MaybeSource}s
  12. * @param mapper the function called with the upstream item and should return
  13. * a {@code MaybeSource} to become the next source to
  14. * be subscribed to
  15. * @return a new Observable instance
  16. * @since 2.1.11 - experimental
  17. * @see #concatMapMaybe(Function)
  18. * @see #concatMapMaybeDelayError(Function, boolean)
  19. */
  20. @CheckReturnValue
  21. @SchedulerSupport(SchedulerSupport.NONE)
  22. @Experimental
  23. public final <R> Observable<R> concatMapMaybeDelayError(Function<? super T, ? extends MaybeSource<? extends R>> mapper) {
  24. return concatMapMaybeDelayError(mapper, true, 2);
  25. }

代码示例来源:origin: redisson/redisson

  1. @Experimental
  2. public final <R> Observable<R> concatMapMaybeDelayError(Function<? super T, ? extends MaybeSource<? extends R>> mapper, boolean tillTheEnd) {
  3. return concatMapMaybeDelayError(mapper, tillTheEnd, 2);

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

  1. @Test
  2. public void delayAllErrors() {
  3. Observable.range(1, 5)
  4. .concatMapMaybeDelayError(new Function<Integer, MaybeSource<? extends Object>>() {
  5. @Override
  6. public MaybeSource<? extends Object> apply(Integer v)
  7. throws Exception {
  8. return Maybe.error(new TestException());
  9. }
  10. })
  11. .test()
  12. .assertFailure(CompositeException.class)
  13. .assertOf(new Consumer<TestObserver<Object>>() {
  14. @Override
  15. public void accept(TestObserver<Object> to) throws Exception {
  16. CompositeException ce = (CompositeException)to.errors().get(0);
  17. assertEquals(5, ce.getExceptions().size());
  18. }
  19. });
  20. }

相关文章

Observable类方法