@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); }
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);
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(){
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);
public Operator<Integer> createThreeErrors(){ return new ZippingOperator<Integer,Integer,Integer>(new ArrayOfValuesOperator<>(10,11,12),Fixtures.threeErrorsSource,(a,b)->a+b); }
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);
@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; }
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);
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(){
public Operator<Integer> createEmpty(){ return new ZippingOperator<Integer,Integer,Integer>(new ArrayOfValuesOperator<>(),new ArrayOfValuesOperator<>(),(a, b)->a+b); } public Operator<Integer> createOne(){
public Operator<Integer> createOne(){ return new ZippingOperator<Integer,Integer,Integer>(new ArrayOfValuesOperator<>(1),new ArrayOfValuesOperator<>(2),(a,b)->a+b); }
@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); }
@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; }