public static < T , R1 , R > CompletableFuture < R > forEach2 ( CompletableFuture < ? extends T > value1 , Function < ? super T , CompletableFuture < R1 > > value2 , BiFunction < ? super T , ? super R1 , ? extends R > yieldingFunction ) { return value1 . thenCompose ( in -> { CompletableFuture < R1 > a = value2 . apply ( in ) ; return a . thenApply ( ina -> yieldingFunction . apply ( in , ina ) ) ; } ) ; }
Perform a For Comprehension over a CompletableFuture accepting a generating function . This results in a two level nested internal iteration over the provided CompletableFutures .