Skip to content

Commit

Permalink
javadoc
Browse files Browse the repository at this point in the history
  • Loading branch information
johnmcclean committed Oct 12, 2016
1 parent f927be0 commit a365a1d
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions cyclops-reactor/src/main/java/com/aol/cyclops/reactor/Fluxes.java
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,30 @@ public static <T1, T2, T3, R1, R2, R3, R> Flux<R> forEach(Flux<? extends T1> val

}

/**
* Perform a For Comprehension over a Flux, accepting 2 generating functions.
* This results in a three level nested internal iteration over the provided Publishers.
*
* <pre>
* {@code
*
* import static com.aol.cyclops.reactor.Fluxes.forEach;
*
* forEach(Flux.range(1,10),
a-> ReactiveSeq.iterate(a,i->i+1).limit(10),
(a,b) -> Maybe.<Integer>of(a+b),
Tuple::tuple);
*
* }
* </pre>
*
*
* @param value1 top level Flux
* @param value2 Nested publisher
* @param value3 Nested publisher
* @param yieldingFunction Generates a result per combination
* @return Flux with an element per combination of nested publishers generated by the yielding function
*/
public static <T1, T2, R1, R2, R> Flux<R> forEach(Flux<? extends T1> value1,
Function<? super T1, ? extends Publisher<R1>> value2,
BiFunction<? super T1, ? super R1, ? extends Publisher<R2>> value3,
Expand All @@ -163,6 +187,29 @@ public static <T1, T2, R1, R2, R> Flux<R> forEach(Flux<? extends T1> value1,

}

/**
* Perform a For Comprehension over a Flux, accepting 2 generating functions.
* This results in a three level nested internal iteration over the provided Publishers.
* <pre>
* {@code
*
* import static com.aol.cyclops.reactor.Fluxes.forEach;
*
* forEach(Flux.range(1,10),
a-> ReactiveSeq.iterate(a,i->i+1).limit(10),
(a,b) -> Maybe.<Integer>of(a+b),
(a,b,c) ->a+b+c<10,
Tuple::tuple).toListX();
* }
* </pre>
*
* @param value1 top level Flux
* @param value2 Nested publisher
* @param value3 Nested publisher
* @param filterFunction A filtering function, keeps values where the predicate holds
* @param yieldingFunction Generates a result per combination
* @return
*/
public static <T1, T2, R1, R2, R> Flux<R> forEach(Flux<? extends T1> value1,
Function<? super T1, ? extends Publisher<R1>> value2,
BiFunction<? super T1, ? super R1, ? extends Publisher<R2>> value3,
Expand All @@ -180,6 +227,8 @@ public static <T1, T2, R1, R2, R> Flux<R> forEach(Flux<? extends T1> value1,
}

/**
* Perform a For Comprehension over a Flux, accepting an additonal generating function.
* This results in a two level nested internal iteration over the provided Publishers.
*
* <pre>
* {@code
Expand Down

0 comments on commit a365a1d

Please sign in to comment.