cyclops.reactive.ReactiveSeq.reduceAll()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(1.9k)|赞(0)|评价(0)|浏览(202)

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

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));
}

相关文章

微信公众号

最新文章

更多

ReactiveSeq类方法