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

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

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

Flowable.never介绍

[英]Returns a Flowable that never sends any items or notifications to a Subscriber.

This Publisher is useful primarily for testing purposes. Backpressure: This source doesn't produce any elements and effectively ignores downstream backpressure. Scheduler: never does not operate by default on a particular Scheduler.
[中]返回从不向订阅服务器发送任何项目或通知的Flowable。
此发布服务器主要用于测试目的。背压:该源不产生任何元素,有效地忽略了下游背压。计划程序:默认情况下,从不在特定计划程序上运行。

代码示例

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

@Override
  public Flowable<Object> apply(Integer left) throws Exception {
    return Flowable.never();
  }
},

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

@Override
  public Flowable<Object> apply(Object right) throws Exception {
    return Flowable.never();
  }
},

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

@Override
  public Flowable<Integer> apply(Integer v) throws Exception {
    if (v == 1) {
      return pp2;
    }
    return Flowable.never();
  }
})

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

@Override
  public Flowable<Object> call() {
    return Flowable.never();
  }
}

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

@Override
  public Flowable<Integer> apply(Integer v) throws Exception {
    return Flowable.never();
  }
}))

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

@Override
  public Flowable<Object> apply(Object v) throws Exception {
    return Flowable.never();
  }
},

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

@Override
  public Flowable<List<Object>> apply(Flowable<Object> f)
      throws Exception {
    return f.buffer(Flowable.never());
  }
}

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

@Override
  public Flowable<Integer> apply(Integer v) throws Exception {
    ts.cancel();
    return Flowable.never();
  }
}, 1, 128)

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

@Override
  public Flowable<Object> apply(Integer o) throws Exception {
    ts.cancel();
    return Flowable.never();
  }
})

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

@Override
  public Publisher<Object> apply(Completable m) throws Exception {
    return m.andThen(Flowable.never());
  }
});

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

@SuppressWarnings("unchecked")
@Test
public void singleElementArray() {
  assertSame(Flowable.never(), Flowable.concatArrayDelayError(Flowable.never()));
}

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

@SuppressWarnings("unchecked")
  @Override
  public Publisher<Long> createPublisher(long elements) {
    return
      Flowable.amb(Arrays.asList(
          Flowable.fromIterable(iterate(elements)),
          Flowable.<Long>never()
        )
      )
    ;
  }
}

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

@SuppressWarnings("unchecked")
  @Override
  public Publisher<Long> createPublisher(long elements) {
    return
        Flowable.ambArray(
            Flowable.fromIterable(iterate(elements)),
            Flowable.<Long>never()
        )
      ;
  }
}

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

@SuppressWarnings("unchecked")
@Test(expected = NullPointerException.class)
public void combineLatestDelayErrorVarargsOneIsNull() {
  Flowable.combineLatestDelayError(new Function<Object[], Object>() {
    @Override
    public Object apply(Object[] v) {
      return 1;
    }
  }, 128, Flowable.never(), null).blockingLast();
}

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

@Test
@SuppressWarnings("unchecked")
public void openClosemainError() {
  Flowable.error(new TestException())
  .buffer(Flowable.never(), Functions.justFunction(Flowable.never()))
  .test()
  .assertFailure(TestException.class);
}

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

@Test
public void mainError() {
  Flowable.error(new TestException())
  .window(Functions.justCallable(Flowable.never()))
  .test()
  .assertError(TestException.class);
}

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

@Test
public void boundaryOnError() {
  TestSubscriber<Object> ts = Flowable.error(new TestException())
  .window(Flowable.never())
  .flatMap(Functions.<Flowable<Object>>identity(), true)
  .test()
  .assertFailure(CompositeException.class);
  List<Throwable> errors = TestHelper.compositeList(ts.errors().get(0));
  TestHelper.assertError(errors, 0, TestException.class);
}

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

@Test
public void awaitCountTimeout() {
  TestSubscriber<Object> ts = Flowable.never()
  .test()
  .awaitCount(1, TestWaitStrategy.SLEEP_1MS, 50);
  assertTrue(ts.isTimeout());
  ts.clearTimeout();
  assertFalse(ts.isTimeout());
}

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

@SuppressWarnings({ "rawtypes", "unchecked" })
  @Override
  public Publisher<List<Long>> createPublisher(long elements) {
    return
      Flowable.fromIterable(iterate(elements))
      .window(Flowable.just(1).concatWith(Flowable.<Integer>never()))
      .onBackpressureBuffer()
      .flatMap((Function)Functions.identity())
    ;
  }
}

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

@Test
public void dispose() {
  TestHelper.checkDisposed(Flowable.never().lastElement().toFlowable());
  TestHelper.checkDisposed(Flowable.never().lastElement());
  TestHelper.checkDisposed(Flowable.just(1).lastOrError().toFlowable());
  TestHelper.checkDisposed(Flowable.just(1).lastOrError());
  TestHelper.checkDisposed(Flowable.just(1).last(2).toFlowable());
  TestHelper.checkDisposed(Flowable.just(1).last(2));
}

相关文章

Flowable类方法