本文整理了Java中io.reactivex.Flowable.combineLatestDelayError()
方法的一些代码示例,展示了Flowable.combineLatestDelayError()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Flowable.combineLatestDelayError()
方法的具体详情如下:
包路径:io.reactivex.Flowable
类名称:Flowable
方法名:combineLatestDelayError
[英]Combines a collection of source Publishers by emitting an item that aggregates the latest values of each of the source Publishers each time an item is received from any of the source Publisher, where this aggregation is defined by a specified function and delays any error from the sources until all source Publishers terminate.
Note on method signature: since Java doesn't allow creating a generic array with new T[], the implementation of this operator has to create an Object[] instead. Unfortunately, a Function passed to the method would trigger a ClassCastException.
If any of the sources never produces an item but only terminates (normally or with an error), the resulting sequence terminates immediately (normally or with all the errors accumulated until that point). If that input source is also synchronous, other sources after it will not be subscribed to.
If there are no source Publishers provided, the resulting sequence completes immediately without emitting any items and without any calls to the combiner function. Backpressure: The returned Publisher honors backpressure from downstream. The source Publishers are requested in a bounded manner, however, their backpressure is not enforced (the operator won't signal MissingBackpressureException) and may lead to OutOfMemoryError due to internal buffer bloat. Scheduler: combineLatestDelayError does not operate by default on a particular Scheduler.
[中]通过发出一个项来组合源发布服务器的集合,该项在每次从任何源发布服务器接收到项时聚合每个源发布服务器的最新值,其中此聚合由指定函数定义,并延迟源发布服务器的任何错误,直到所有源发布服务器终止。
关于方法签名的注意事项:由于Java不允许使用新的t[]创建泛型数组,因此该操作符的实现必须创建一个对象[]。不幸的是,传递给该方法的函数将触发ClassCastException。
如果任何一个源从未生成一个项,而只是终止(正常或有错误),则生成的序列立即终止(正常或所有错误累积到该点)。如果该输入源也是同步的,则不会订阅它之后的其他源。
如果没有提供源发布程序,则生成的序列将立即完成,而不会发出任何项,也不会调用组合器函数。背压:返回的发布者接受来自下游的背压。源发布服务器是以有限制的方式请求的,但是,它们的背压不会强制执行(操作员不会发出MissingBackpressureException的信号),并且可能由于内部缓冲区膨胀而导致OutOfMemoryError。调度程序:CombineRelatestDelayError默认情况下不会在特定调度程序上运行。
代码示例来源:origin: ReactiveX/RxJava
@Test(expected = NullPointerException.class)
public void combineLatestDelayErrorVarargsNull() {
Flowable.combineLatestDelayError(new Function<Object[], Object>() {
@Override
public Object apply(Object[] v) {
return 1;
}
}, 128, (Flowable<Object>[])null);
}
代码示例来源:origin: ReactiveX/RxJava
@Test(expected = NullPointerException.class)
public void combineLatestIterableNull() {
Flowable.combineLatestDelayError((Iterable<Publisher<Object>>)null, new Function<Object[], Object>() {
@Override
public Object apply(Object[] v) {
return 1;
}
});
}
代码示例来源:origin: ReactiveX/RxJava
@SuppressWarnings("unchecked")
@Test(expected = NullPointerException.class)
public void combineLatestIterableFunctionNull() {
Flowable.combineLatestDelayError(Arrays.asList(just1), null);
}
代码示例来源:origin: ReactiveX/RxJava
@Test(expected = NullPointerException.class)
public void combineLatestDelayErrorIterableNull() {
Flowable.combineLatestDelayError((Iterable<Flowable<Object>>)null, new Function<Object[], Object>() {
@Override
public Object apply(Object[] v) {
return 1;
}
}, 128);
}
代码示例来源:origin: ReactiveX/RxJava
@SuppressWarnings("unchecked")
@Test(expected = NullPointerException.class)
public void combineLatestDelayErrorIterableFunctionNull() {
Flowable.combineLatestDelayError(Arrays.asList(just1), null, 128);
}
代码示例来源:origin: ReactiveX/RxJava
@Test(expected = NullPointerException.class)
public void combineLatestVarargsNull() {
Flowable.combineLatestDelayError(new Function<Object[], Object>() {
@Override
public Object apply(Object[] v) {
return 1;
}
}, (Publisher<Object>[])null);
}
代码示例来源: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 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 combineLatestDelayErrorVarargsFunctionNull() {
Flowable.combineLatestDelayError(null, 128, Flowable.never());
}
代码示例来源:origin: ReactiveX/RxJava
@SuppressWarnings("unchecked")
@Test(expected = NullPointerException.class)
public void combineLatestVarargsFunctionNull() {
Flowable.combineLatestDelayError(null, Flowable.never());
}
代码示例来源:origin: ReactiveX/RxJava
@SuppressWarnings("unchecked")
@Test(expected = NullPointerException.class)
public void combineLatestVarargsFunctionReturnsNull() {
Flowable.combineLatestDelayError(new Function<Object[], Object>() {
@Override
public Object apply(Object[] v) {
return null;
}
}, just1).blockingLast();
}
代码示例来源:origin: ReactiveX/RxJava
@SuppressWarnings("unchecked")
@Test(expected = NullPointerException.class)
public void combineLatestDelayErrorVarargsFunctionReturnsNull() {
Flowable.combineLatestDelayError(new Function<Object[], Object>() {
@Override
public Object apply(Object[] v) {
return null;
}
}, 128, just1).blockingLast();
}
}
代码示例来源:origin: ReactiveX/RxJava
@Test(expected = NullPointerException.class)
public void combineLatestDelayErrorIterableIteratorNull() {
Flowable.combineLatestDelayError(new Iterable<Flowable<Object>>() {
@Override
public Iterator<Flowable<Object>> iterator() {
return 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 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 combineLatestDelayErrorVarargsOneIsNull() {
Flowable.combineLatestDelayError(new Function<Object[], Object>() {
@Override
public Object apply(Object[] v) {
return 1;
}
}, 128, Flowable.never(), null).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
public void combineLatestDelayErrorEmpty() {
assertSame(Flowable.empty(), Flowable.combineLatestDelayError(new Flowable[0], Functions.<Object[]>identity(), 16));
}
代码示例来源:origin: ReactiveX/RxJava
@Test
@SuppressWarnings("unchecked")
public void combineLatestDelayErrorArrayOfSources() {
Flowable.combineLatestDelayError(new Flowable[] {
Flowable.just(1), Flowable.just(2)
}, new Function<Object[], Object>() {
@Override
public Object apply(Object[] a) throws Exception {
return Arrays.toString(a);
}
})
.test()
.assertResult("[1, 2]");
}
代码示例来源:origin: ReactiveX/RxJava
@Test
@SuppressWarnings("unchecked")
public void combineLatestDelayErrorArrayOfSourcesWithError() {
Flowable.combineLatestDelayError(new Flowable[] {
Flowable.just(1), Flowable.just(2).concatWith(Flowable.<Integer>error(new TestException()))
}, new Function<Object[], Object>() {
@Override
public Object apply(Object[] a) throws Exception {
return Arrays.toString(a);
}
})
.test()
.assertFailure(TestException.class, "[1, 2]");
}
内容来源于网络,如有侵权,请联系作者删除!