!str - replaces flattenConcat with flatMapConcat

This commit is contained in:
Viktor Klang 2015-11-03 14:46:17 +01:00
parent 1378fedad0
commit 50c6f2267c
22 changed files with 112 additions and 96 deletions

View file

@ -1,6 +1,7 @@
package docs;
import akka.japi.Pair;
import akka.japi.function.Function;
import akka.stream.*;
import akka.stream.javadsl.*;
import scala.Option;
@ -64,7 +65,7 @@ public class MigrationsJava {
FlowGraph.create(builder -> {
//...
return new FlowShape(inlet, outlet);
return new FlowShape<>(inlet, outlet);
});
//#graph-create
}
@ -117,9 +118,14 @@ public class MigrationsJava {
Flow<Integer, Integer, BoxedUnit> emptyFlow2 = Flow.of(Integer.class);
//#empty-flow
//#flattenConcat
Flow.<Source<Integer, BoxedUnit>>create().flattenConcat();
//#flattenConcat
//#flatMapConcat
Flow.<Source<Integer, BoxedUnit>>create().
<Integer>flatMapConcat(new Function<Source<Integer, BoxedUnit>, Source<Integer, ?>>(){
@Override public Source<Integer, ?> apply(Source<Integer, BoxedUnit> param) throws Exception {
return param;
}
});
//#flatMapConcat
}
}

View file

@ -263,12 +263,13 @@ should be replaced by
====================================================================
To simplify type inference in Java 8 and to make the method more discoverable, ``flatten(FlattenStrategy.concat)``
has been removed and replaced with the alternative method ``flatten(FlattenStrategy.concat)``.
has been removed and replaced with the alternative method ``flatMapConcat(f)``.
Update procedure
----------------
1. Replace all occurences of ``flatten(FlattenStrategy.concat)`` with ``flattenConcat()``
1. Replace all occurrences of ``flatten(FlattenStrategy.concat)`` with ``flatMapConcat(identity)``
2. Consider replacing ``map(f).flatMapConcat(identity)`` with ``flatMapConcat(f)``
Example
^^^^^^^
@ -279,7 +280,7 @@ Example
should be replaced by
.. includecode:: code/docs/MigrationsJava.java#flattenConcat
.. includecode:: code/docs/MigrationsJava.java#flatMapConcat
FlexiMerge an FlexiRoute has been replaced by GraphStage
========================================================