19455 Simplify conflate signature for the common case

This commit is contained in:
Endre Sándor Varga 2016-01-22 15:22:30 +01:00
parent c36fdb111c
commit 3081e2895b
21 changed files with 281 additions and 55 deletions

View file

@ -60,7 +60,7 @@ public class RateTransformationDocTest {
//#conflate-summarize
final Flow<Double, Tuple3<Double, Double, Integer>, NotUsed> statsFlow =
Flow.of(Double.class)
.conflate(elem -> Collections.singletonList(elem), (acc, elem) -> {
.conflateWithSeed(elem -> Collections.singletonList(elem), (acc, elem) -> {
return Stream
.concat(acc.stream(), Collections.singletonList(elem).stream())
.collect(Collectors.toList());
@ -86,7 +86,7 @@ public class RateTransformationDocTest {
//#conflate-sample
final Double p = 0.01;
final Flow<Double, Double, NotUsed> sampleFlow = Flow.of(Double.class)
.conflate(elem -> Collections.singletonList(elem), (acc, elem) -> {
.conflateWithSeed(elem -> Collections.singletonList(elem), (acc, elem) -> {
if (r.nextDouble() < p) {
return Stream
.concat(acc.stream(), Collections.singletonList(elem).stream())