/** * Creates a new Build step based on this builder but with a subsequent producer inserted after * the original protocol producer. The two producer will be evalueted in parallel, however each * of the two functions will be evaluated in sequence. * * @param firstFunction of the first protocol producer - will be lazy evaluated * @param secondFunction of the second protocol producer - will be lazy evaluated */ public <FirstOutputT, SecondOutputT> BuildStep<OutputT, BuilderT, Pair<FirstOutputT, SecondOutputT>> pairInPar( FrescoLambda<OutputT, BuilderT, FirstOutputT> firstFunction, FrescoLambda<OutputT, BuilderT, SecondOutputT> secondFunction) { BuildStep<OutputT, BuilderT, Pair<FirstOutputT, SecondOutputT>> localChild = new BuildStep<>( new BuildStepSingle<>( (BuilderT builder, OutputT output1) -> { DRes<FirstOutputT> firstOutput = builder.seq( seq -> firstFunction.buildComputation(seq, output1)); DRes<SecondOutputT> secondOutput = builder.seq( seq -> secondFunction.buildComputation(seq, output1)); return () -> new Pair<>(firstOutput.out(), secondOutput.out()); }, true) ); this.next = localChild; return localChild; }