本文整理了Java中io.reactivex.Observable.blockingLast()
方法的一些代码示例,展示了Observable.blockingLast()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Observable.blockingLast()
方法的具体详情如下:
包路径:io.reactivex.Observable
类名称:Observable
方法名:blockingLast
[英]Returns the last item emitted by this Observable, or throws NoSuchElementException if this Observable emits no items.
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
@Test(expected = NullPointerException.class)
public void fromFutureTimedReturnsNull() {
FutureTask<Object> f = new FutureTask<Object>(Functions.EMPTY_RUNNABLE, null);
f.run();
Observable.fromFuture(f, 1, TimeUnit.SECONDS).blockingLast();
}
代码示例来源:origin: ReactiveX/RxJava
@SuppressWarnings("unchecked")
@Test(expected = NullPointerException.class)
public void combineLatestDelayErrorIterableFunctionReturnsNull() {
Observable.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 concatIterableOneIsNull() {
Observable.concat(Arrays.asList(just1, null)).blockingLast();
}
代码示例来源:origin: ReactiveX/RxJava
@Test(expected = NullPointerException.class)
public void zipObservableFunctionReturnsNull() {
Observable.zip((Observable.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 zipIterable2FunctionReturnsNull() {
Observable.zipIterable(Arrays.asList(just1, just1), new Function<Object[], Object>() {
@Override
public Object apply(Object[] a) {
return null;
}
}, true, 128).blockingLast();
}
代码示例来源:origin: ReactiveX/RxJava
@SuppressWarnings("unchecked")
@Test(expected = NullPointerException.class)
public void mergeIterableOneIsNull() {
Observable.merge(Arrays.asList(just1, null), 128, 128).blockingLast();
}
代码示例来源:origin: ReactiveX/RxJava
@SuppressWarnings("unchecked")
@Test(expected = NullPointerException.class)
public void combineLatestDelayErrorVarargsFunctionReturnsNull() {
Observable.combineLatestDelayError(new Function<Object[], Object>() {
@Override
public Object apply(Object[] v) {
return null;
}
}, 128, just1).blockingLast();
}
代码示例来源:origin: ReactiveX/RxJava
@SuppressWarnings("unchecked")
@Test(expected = NullPointerException.class)
public void concatArrayOneIsNull() {
Observable.concatArray(just1, null).blockingLast();
}
代码示例来源:origin: ReactiveX/RxJava
@Test(expected = NullPointerException.class)
public void mergeIterableIteratorNull() {
Observable.merge(new Iterable<Observable<Object>>() {
@Override
public Iterator<Observable<Object>> iterator() {
return null;
}
}, 128, 128).blockingLast();
}
代码示例来源:origin: ReactiveX/RxJava
@Test(expected = NullPointerException.class)
public void concatIterableIteratorNull() {
Observable.concat(new Iterable<Observable<Object>>() {
@Override
public Iterator<Observable<Object>> iterator() {
return null;
}
}).blockingLast();
}
代码示例来源:origin: ReactiveX/RxJava
@SuppressWarnings("unchecked")
@Test(expected = NullPointerException.class)
public void mergeDelayErrorArrayOneIsNull() {
Observable.mergeArrayDelayError(128, 128, just1, null).blockingLast();
}
代码示例来源:origin: ReactiveX/RxJava
@SuppressWarnings("unchecked")
@Test(expected = NullPointerException.class)
public void combineLatestVarargsFunctionReturnsNull() {
Observable.combineLatest(new Function<Object[], Object>() {
@Override
public Object apply(Object[] v) {
return null;
}
}, 128, just1).blockingLast();
}
代码示例来源:origin: ReactiveX/RxJava
@Test(expected = NullPointerException.class)
public void deferFunctionReturnsNull() {
Observable.defer(new Callable<Observable<Object>>() {
@Override
public Observable<Object> call() {
return null;
}
}).blockingLast();
}
代码示例来源:origin: ReactiveX/RxJava
@Test(expected = NullPointerException.class)
public void fromIterableIteratorNull() {
Observable.fromIterable(new Iterable<Object>() {
@Override
public Iterator<Object> iterator() {
return null;
}
}).blockingLast();
}
代码示例来源:origin: ReactiveX/RxJava
@Test(expected = NullPointerException.class)
public void generateConsumerEmitsNull() {
Observable.generate(new Consumer<Emitter<Object>>() {
@Override
public void accept(Emitter<Object> s) {
s.onNext(null);
}
}).blockingLast();
}
代码示例来源:origin: ReactiveX/RxJava
@SuppressWarnings("unchecked")
@Test(expected = NullPointerException.class)
public void mergeArrayOneIsNull() {
Observable.mergeArray(128, 128, just1, null).blockingLast();
}
代码示例来源:origin: ReactiveX/RxJava
@SuppressWarnings("unchecked")
@Test(expected = NullPointerException.class)
public void combineLatestIterableOneIsNull() {
Observable.combineLatest(Arrays.asList(Observable.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 combineLatestDelayErrorIterableOneIsNull() {
Observable.combineLatestDelayError(Arrays.asList(Observable.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() {
Observable.combineLatest(new Function<Object[], Object>() {
@Override
public Object apply(Object[] v) {
return 1;
}
}, 128, Observable.never(), null).blockingLast();
}
代码示例来源:origin: ReactiveX/RxJava
@SuppressWarnings("unchecked")
@Test(expected = NullPointerException.class)
public void ambVarargsOneIsNull() {
Observable.ambArray(Observable.never(), null).blockingLast();
}
内容来源于网络,如有侵权,请联系作者删除!