本文整理了Java中cyclops.reactive.ReactiveSeq.reduceAll
方法的一些代码示例,展示了ReactiveSeq.reduceAll
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ReactiveSeq.reduceAll
方法的具体详情如下:
包路径:cyclops.reactive.ReactiveSeq
类名称:ReactiveSeq
方法名:reduceAll
暂无
代码示例来源:origin: aol/cyclops
default ReactiveSeq<T> foldLeftAsync(final Publisher<T> toFold){
return Spouts.from(toFold).reduceAll(this.zero(),this);
}
default T foldLeft(final Iterable<T> toFold){
代码示例来源:origin: aol/cyclops
default ReactiveSeq<T> foldRightAsync(final Publisher<T> toReduce) {
return Spouts.from(toReduce).reduceAll(zero(), this);
}
代码示例来源:origin: aol/cyclops
@Test
public void asyncReduce(){
assertThat(Spouts.of(1, 2, 3, 4, 5)
.peek(System.out::println)
.reduceAll(0,(a,b)->a+b)
.singleOrElse(null),equalTo(15));
}
@Test
代码示例来源:origin: aol/cyclops
private Either<Error,Vector<String>> loadContents(Vector<DataFileMetadata> files){
/**
return Spouts.from(Flux.from(files.stream())
.flatMap(file->asyncWithRetry(1,file,exec),10))
.reduceAll(Vector.<String>empty(), Vector::appendAll)
.findFirstOrError()
.mapLeft(t-> Error.LOADING_FAILED);
**/
return files.stream()
.mergeMap(10,file->asyncWithRetry(1,file,exec))
.reduceAll(Vector.<String>empty(), Vector::appendAll)
.findFirstOrError()
.mapLeft(t-> Error.LOADING_FAILED);
}
}
代码示例来源:origin: com.oath.cyclops/cyclops
default ReactiveSeq<T> foldLeftAsync(final Publisher<T> toFold){
return Spouts.from(toFold).reduceAll(this.zero(),this);
}
default T foldLeft(final Iterable<T> toFold){
代码示例来源:origin: com.oath.cyclops/cyclops
default ReactiveSeq<T> foldRightAsync(final Publisher<T> toReduce) {
return Spouts.from(toReduce).reduceAll(zero(), this);
}
代码示例来源:origin: com.oath.cyclops/cyclops-futurestream
@Override
default <R> FutureStream<R> reduceAll(R identity, BiFunction<R, ? super U, R> accumulator) {
return fromStream(stream().reduceAll(identity,accumulator));
}
内容来源于网络,如有侵权,请联系作者删除!