com.oath.cyclops.internal.stream.spliterators.push.ZippingOperator类的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(5.6k)|赞(0)|评价(0)|浏览(96)

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

ZippingOperator介绍

[英]Created by johnmcclean on 12/01/2017.
[中]由JohnmcLean于2017年1月12日创建。

代码示例

代码示例来源:origin: aol/cyclops

@Override
public <U, R> ReactiveSeq<R> zipWithStream(Stream<? extends U> other, BiFunction<? super T, ? super U, ? extends R> zipper) {
  Operator<U> right;
  if (other instanceof ReactiveStreamX) {
    right = ((ReactiveStreamX<U>) other).source;
  } else {
    right = new SpliteratorToOperator<U>(((Stream<U>) other).spliterator());
  }
  return createSeq(new ZippingOperator<>(source, right, zipper), async);
}

代码示例来源:origin: aol/cyclops

while (leftQ.isEmpty()) { // VALUE IS COMING
      if(leftComplete.get() && leftQ.isEmpty()){
        handleComplete(completing,onCompleteDs);
        return;
handleComplete(completing,onCompleteDs);
handleComplete(completing,onCompleteDs);
        handleComplete(completing,onCompleteDs);
        return;
handleComplete(completing,onCompleteDs);
if(rightSub[0]!=null)
  rightSub[0].cancel();
handleComplete(completing,onCompleteDs);

代码示例来源:origin: aol/cyclops

public Operator<Integer> createTwoAndError(){
  return new ZippingOperator<Integer,Integer,Integer>(Fixtures.twoAndErrorSource,new ArrayOfValuesOperator<>(10,11,12),(a, b)->a+b);
}
public Operator<Integer> createThreeErrors(){

代码示例来源:origin: aol/cyclops

handleComplete(completing,onComplete);
        return;
handleComplete(completing,onComplete);
if(rightSub[0]!=null)
  rightSub[0].cancel();
handleComplete(completing,onComplete);
    while (leftQ.isEmpty()) { // VALUE IS COMING  - LEFT IS ADDING TO Q
      if(leftComplete.get() && leftQ.isEmpty()){
        handleComplete(completing,onComplete);
        return;
handleComplete(completing,onComplete);
if(leftSub[0]!=null)
  leftSub[0].cancel();
handleComplete(completing,onComplete);

代码示例来源:origin: aol/cyclops

public Operator<Integer> createThreeErrors(){
  return new ZippingOperator<Integer,Integer,Integer>(new ArrayOfValuesOperator<>(10,11,12),Fixtures.threeErrorsSource,(a,b)->a+b);
}

代码示例来源:origin: com.oath.cyclops/cyclops

while (leftQ.isEmpty()) { // VALUE IS COMING
      if(leftComplete.get() && leftQ.isEmpty()){
        handleComplete(completing,onCompleteDs);
        return;
handleComplete(completing,onCompleteDs);
handleComplete(completing,onCompleteDs);
        handleComplete(completing,onCompleteDs);
        return;
handleComplete(completing,onCompleteDs);
if(rightSub[0]!=null)
  rightSub[0].cancel();
handleComplete(completing,onCompleteDs);

代码示例来源:origin: aol/cyclops

@Override
public <U> ReactiveSeq<Tuple2<T, U>> zipWithStream(Stream<? extends U> other) {
  Operator<U> right;
  if (other instanceof ReactiveStreamX) {
    right = ((ReactiveStreamX<U>) other).source;
  } else if (other instanceof Iterable) {
    right = new IterableSourceOperator<U>(((Iterable<U>) other));
  } else {
    //not replayable
    right = new SpliteratorToOperator<U>(((Stream<U>) other).spliterator());
  }
  ReactiveStreamX<Tuple2<T, U>> res = createSeq(new ZippingOperator<>(source, right, Tuple::tuple));
  if (this.async == SYNC) {
    //zip could recieve an asyncrhonous Stream so we force onto the async path
    return res.withAsync(BACKPRESSURE);
  }
  return res;
}

代码示例来源:origin: com.oath.cyclops/cyclops

handleComplete(completing,onComplete);
        return;
handleComplete(completing,onComplete);
if(rightSub[0]!=null)
  rightSub[0].cancel();
handleComplete(completing,onComplete);
    while (leftQ.isEmpty()) { // VALUE IS COMING  - LEFT IS ADDING TO Q
      if(leftComplete.get() && leftQ.isEmpty()){
        handleComplete(completing,onComplete);
        return;
handleComplete(completing,onComplete);
if(leftSub[0]!=null)
  leftSub[0].cancel();
handleComplete(completing,onComplete);

代码示例来源:origin: aol/cyclops

public Operator<Integer> createThree(){
  return new ZippingOperator<Integer,Integer,Integer>(new ArrayOfValuesOperator<>(1,2,3),new ArrayOfValuesOperator<>(10,11,12),(a,b)->a+b);
}
public Operator<Integer> createTwoAndError(){

代码示例来源:origin: aol/cyclops

public Operator<Integer> createEmpty(){
  return new ZippingOperator<Integer,Integer,Integer>(new ArrayOfValuesOperator<>(),new ArrayOfValuesOperator<>(),(a, b)->a+b);
}
public Operator<Integer> createOne(){

代码示例来源:origin: aol/cyclops

public Operator<Integer> createOne(){
  return new ZippingOperator<Integer,Integer,Integer>(new ArrayOfValuesOperator<>(1),new ArrayOfValuesOperator<>(2),(a,b)->a+b);
}

代码示例来源:origin: com.oath.cyclops/cyclops

@Override
public <U, R> ReactiveSeq<R> zipWithStream(Stream<? extends U> other, BiFunction<? super T, ? super U, ? extends R> zipper) {
  Operator<U> right;
  if (other instanceof ReactiveStreamX) {
    right = ((ReactiveStreamX<U>) other).source;
  } else {
    right = new SpliteratorToOperator<U>(((Stream<U>) other).spliterator());
  }
  return createSeq(new ZippingOperator<>(source, right, zipper), async);
}

代码示例来源:origin: com.oath.cyclops/cyclops

@Override
public <U> ReactiveSeq<Tuple2<T, U>> zipWithStream(Stream<? extends U> other) {
  Operator<U> right;
  if (other instanceof ReactiveStreamX) {
    right = ((ReactiveStreamX<U>) other).source;
  } else if (other instanceof Iterable) {
    right = new IterableSourceOperator<U>(((Iterable<U>) other));
  } else {
    //not replayable
    right = new SpliteratorToOperator<U>(((Stream<U>) other).spliterator());
  }
  ReactiveStreamX<Tuple2<T, U>> res = createSeq(new ZippingOperator<>(source, right, Tuple::tuple));
  if (this.async == SYNC) {
    //zip could recieve an asyncrhonous Stream so we force onto the async path
    return res.withAsync(BACKPRESSURE);
  }
  return res;
}

相关文章