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

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

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

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

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

@SuppressWarnings("unchecked")
@Test(expected = NullPointerException.class)
public void zipIterableFunctionReturnsNull() {
  Flowable.zip(Arrays.asList(just1, just1), new Function<Object[], Object>() {
    @Override
    public Object apply(Object[] a) {
      return null;
    }
  }).blockingLast();
}

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

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

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

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

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

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

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

@Test(expected = NullPointerException.class)
public void fromCallableReturnsNull() {
  Flowable.fromCallable(new Callable<Object>() {
    @Override
    public Object call() throws Exception {
      return null;
    }
  }).blockingLast();
}

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

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

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

@Test(expected = NullPointerException.class)
public void concatIterableIteratorNull() {
  Flowable.concat(new Iterable<Publisher<Object>>() {
    @Override
    public Iterator<Publisher<Object>> iterator() {
      return null;
    }
  }).blockingLast();
}

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

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

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

@Test(expected = NullPointerException.class)
public void mergeIterableIteratorNull() {
  Flowable.merge(new Iterable<Publisher<Object>>() {
    @Override
    public Iterator<Publisher<Object>> iterator() {
      return null;
    }
  }, 128, 128).blockingLast();
}

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

@Test(expected = NullPointerException.class)
public void mergeDelayErrorIterableIteratorNull() {
  Flowable.mergeDelayError(new Iterable<Publisher<Object>>() {
    @Override
    public Iterator<Publisher<Object>> iterator() {
      return null;
    }
  }, 128, 128).blockingLast();
}

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

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

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

@Test(expected = NullPointerException.class)
public void fromIterableIteratorNull() {
  Flowable.fromIterable(new Iterable<Object>() {
    @Override
    public Iterator<Object> iterator() {
      return null;
    }
  }).blockingLast();
}

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

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

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

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

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

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

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

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

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

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

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

@Test(expected = NullPointerException.class)
public void zipPublisherFunctionReturnsNull() {
  Flowable.zip((Flowable.just(just1)), new Function<Object[], Object>() {
    @Override
    public Object apply(Object[] a) {
      return null;
    }
  }).blockingLast();
}

代码示例来源: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();
}

相关文章

Flowable类方法