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

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

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

Observable.mergeArray介绍

[英]Flattens an Iterable of ObservableSources into one ObservableSource, without any transformation, while limiting the number of concurrent subscriptions to these ObservableSources.

You can combine the items emitted by multiple ObservableSources so that they appear as a single ObservableSource, by using the merge method. Scheduler: mergeArray does not operate by default on a particular Scheduler. Error handling: If any of the source ObservableSources signal a Throwable via onError, the resulting Observable terminates with that Throwable and all other source ObservableSources are cancelled. If more than one ObservableSource signals an error, the resulting Observable may terminate with the first one's error or, depending on the concurrency of the sources, may terminate with a CompositeException containing two or more of the various error signals. Throwables that didn't make into the composite will be sent (individually) to the global error handler via RxJavaPlugins#onError(Throwable) method as UndeliverableException errors. Similarly, Throwables signaled by source(s) after the returned Observable has been cancelled or terminated with a (composite) error will be sent to the same global error handler. Use #mergeArrayDelayError(int,int,ObservableSource...) to merge sources and terminate only when all source ObservableSources have completed or failed with an error.
[中]在不进行任何转换的情况下,将一个可观察资源的可观察部分展平为一个可观察资源,同时限制对这些可观察资源的并发订阅数量。
通过使用merge方法,可以将多个observedsource发出的项组合起来,使它们显示为单个observedsource。调度程序:默认情况下,mergeArray不会在特定调度程序上运行。错误处理:如果任何源可观测资源通过OneError发送一个可丢弃的信号,则生成的可观测结果将与该可丢弃终止,所有其他源可观测资源将被取消。如果一个以上的可观察资源发出错误信号,则产生的可观察资源可能会以第一个的错误终止,或者,根据源的并发性,可能会以包含两个或多个不同错误信号的复合异常终止。未进入组合的一次性文件将作为不可交付的异常错误通过RxJavaPlugins#onError(一次性)方法(单独)发送到全局错误处理程序。类似地,在返回的可观察对象被取消或终止(复合)错误后,源发出的丢弃信号将被发送到同一个全局错误处理程序。使用#MergeArrayLayerror(int,int,ObservableSource…)合并源并仅在所有源ObservableSource都已完成或失败并出现错误时终止。

代码示例

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

@Test(expected = NullPointerException.class)
public void mergeArrayNull() {
  Observable.mergeArray(128, 128, (Observable<Object>[])null);
}

代码示例来源: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
public void mergeArray() {
  Observable.mergeArray(Observable.just(1), Observable.just(2))
  .test()
  .assertResult(1, 2);
}

代码示例来源:origin: spotify/mobius

final Observable<E> eventSource = Observable.mergeArray(sources);

代码示例来源:origin: 7449/JsoupSample

.getInstance()
.getApi(KK_DATA_TAG,
    Observable.mergeArray(list.toArray(new Observable[]{}))
    , new DisposableObserver<List<ImageModel>>() {
      @Override

相关文章

Observable类方法