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

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

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

Flowable.blockingLast介绍

[英]Returns the last item emitted by this Flowable, or throws NoSuchElementException if this Flowable emits no items.

Backpressure: The operator consumes the source Flowable in an unbounded manner (i.e., no backpressure applied to it). Scheduler: blockingLast does not operate by default on a particular Scheduler. Error handling: If the source signals an error, the operator wraps a checked Exceptioninto RuntimeException and throws that. Otherwise, RuntimeExceptions and Errors are rethrown as they are.
[中]返回此可流文件发出的最后一项,如果此可流文件不发出任何项,则抛出NosTouchElementException。
背压:操作员以无限制的方式消耗可流动源(即,不施加背压)。调度程序:默认情况下,blockingLast不会在特定调度程序上运行。错误处理:如果源发出错误信号,操作员将选中的异常包装到RuntimeException中并抛出该异常。否则,运行时异常和错误将按原样重试。

代码示例

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

  1. @SuppressWarnings("unchecked")
  2. @Test(expected = NullPointerException.class)
  3. public void combineLatestDelayErrorIterableFunctionReturnsNull() {
  4. Flowable.combineLatestDelayError(Arrays.asList(just1), new Function<Object[], Object>() {
  5. @Override
  6. public Object apply(Object[] v) {
  7. return null;
  8. }
  9. }, 128).blockingLast();
  10. }

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

  1. @SuppressWarnings("unchecked")
  2. @Test(expected = NullPointerException.class)
  3. public void zipIterableFunctionReturnsNull() {
  4. Flowable.zip(Arrays.asList(just1, just1), new Function<Object[], Object>() {
  5. @Override
  6. public Object apply(Object[] a) {
  7. return null;
  8. }
  9. }).blockingLast();
  10. }

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

  1. @SuppressWarnings("unchecked")
  2. @Test(expected = NullPointerException.class)
  3. public void combineLatestIterableFunctionReturnsNull() {
  4. Flowable.combineLatestDelayError(Arrays.asList(just1), new Function<Object[], Object>() {
  5. @Override
  6. public Object apply(Object[] v) {
  7. return null;
  8. }
  9. }).blockingLast();
  10. }

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

  1. @SuppressWarnings("unchecked")
  2. @Test(expected = NullPointerException.class)
  3. public void concatIterableOneIsNull() {
  4. Flowable.concat(Arrays.asList(just1, null)).blockingLast();
  5. }

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

  1. @SuppressWarnings("unchecked")
  2. @Test(expected = NullPointerException.class)
  3. public void mergeIterableOneIsNull() {
  4. Flowable.merge(Arrays.asList(just1, null), 128, 128).blockingLast();
  5. }

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

  1. @Test(expected = NullPointerException.class)
  2. public void fromCallableReturnsNull() {
  3. Flowable.fromCallable(new Callable<Object>() {
  4. @Override
  5. public Object call() throws Exception {
  6. return null;
  7. }
  8. }).blockingLast();
  9. }

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

  1. @Override
  2. public Integer apply(Integer v) throws Exception {
  3. Flowable.just(1).delay(10, TimeUnit.SECONDS).blockingLast();
  4. return v;
  5. }
  6. })

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

  1. @Test(expected = NullPointerException.class)
  2. public void concatIterableIteratorNull() {
  3. Flowable.concat(new Iterable<Publisher<Object>>() {
  4. @Override
  5. public Iterator<Publisher<Object>> iterator() {
  6. return null;
  7. }
  8. }).blockingLast();
  9. }

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

  1. @SuppressWarnings("unchecked")
  2. @Test(expected = NullPointerException.class)
  3. public void concatArrayOneIsNull() {
  4. Flowable.concatArray(just1, null).blockingLast();
  5. }

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

  1. @Test(expected = NullPointerException.class)
  2. public void mergeIterableIteratorNull() {
  3. Flowable.merge(new Iterable<Publisher<Object>>() {
  4. @Override
  5. public Iterator<Publisher<Object>> iterator() {
  6. return null;
  7. }
  8. }, 128, 128).blockingLast();
  9. }

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

  1. @Test(expected = NullPointerException.class)
  2. public void mergeDelayErrorIterableIteratorNull() {
  3. Flowable.mergeDelayError(new Iterable<Publisher<Object>>() {
  4. @Override
  5. public Iterator<Publisher<Object>> iterator() {
  6. return null;
  7. }
  8. }, 128, 128).blockingLast();
  9. }

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

  1. @Override
  2. public Integer apply(Integer v) throws Exception {
  3. return Flowable.just(2).delay(100, TimeUnit.MILLISECONDS).blockingLast();
  4. }
  5. })

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

  1. @Test(expected = NullPointerException.class)
  2. public void fromIterableIteratorNull() {
  3. Flowable.fromIterable(new Iterable<Object>() {
  4. @Override
  5. public Iterator<Object> iterator() {
  6. return null;
  7. }
  8. }).blockingLast();
  9. }

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

  1. @SuppressWarnings("unchecked")
  2. @Test(expected = NullPointerException.class)
  3. public void mergeArrayOneIsNull() {
  4. Flowable.mergeArray(128, 128, just1, null).blockingLast();
  5. }

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

  1. @SuppressWarnings("unchecked")
  2. @Test(expected = NullPointerException.class)
  3. public void combineLatestIterableOneIsNull() {
  4. Flowable.combineLatestDelayError(Arrays.asList(Flowable.never(), null), new Function<Object[], Object>() {
  5. @Override
  6. public Object apply(Object[] v) {
  7. return 1;
  8. }
  9. }).blockingLast();
  10. }

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

  1. @SuppressWarnings("unchecked")
  2. @Test(expected = NullPointerException.class)
  3. public void combineLatestDelayErrorIterableOneIsNull() {
  4. Flowable.combineLatestDelayError(Arrays.asList(Flowable.never(), null), new Function<Object[], Object>() {
  5. @Override
  6. public Object apply(Object[] v) {
  7. return 1;
  8. }
  9. }, 128).blockingLast();
  10. }

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

  1. @SuppressWarnings("unchecked")
  2. @Test(expected = NullPointerException.class)
  3. public void combineLatestVarargsOneIsNull() {
  4. Flowable.combineLatestDelayError(new Function<Object[], Object>() {
  5. @Override
  6. public Object apply(Object[] v) {
  7. return 1;
  8. }
  9. }, Flowable.never(), null).blockingLast();
  10. }

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

  1. @SuppressWarnings("unchecked")
  2. @Test(expected = NullPointerException.class)
  3. public void ambVarargsOneIsNull() {
  4. Flowable.ambArray(Flowable.never(), null).blockingLast();
  5. }

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

  1. @Test(expected = NullPointerException.class)
  2. public void zipPublisherFunctionReturnsNull() {
  3. Flowable.zip((Flowable.just(just1)), new Function<Object[], Object>() {
  4. @Override
  5. public Object apply(Object[] a) {
  6. return null;
  7. }
  8. }).blockingLast();
  9. }

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

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

相关文章

Flowable类方法