!str - replaces flattenConcat with flatMapConcat
This commit is contained in:
parent
1378fedad0
commit
50c6f2267c
22 changed files with 112 additions and 96 deletions
|
|
@ -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
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
========================================================
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import scala.concurrent.{ Future, ExecutionContext, Promise }
|
|||
import scala.concurrent.duration._
|
||||
import scala.util.{ Failure, Success, Try }
|
||||
|
||||
class Migrations extends AkkaSpec {
|
||||
class MigrationsScala extends AkkaSpec {
|
||||
|
||||
"Examples in migration guide" must {
|
||||
"compile" in {
|
||||
|
|
@ -110,10 +110,9 @@ class Migrations extends AkkaSpec {
|
|||
val ticks = Source(1.second, 3.seconds, "tick")
|
||||
//#source-creators
|
||||
|
||||
//#flatten
|
||||
// Please note that the parenthesis is mandatory due to implicit parameters
|
||||
Flow[Source[Int, Any]].flattenConcat()
|
||||
//#flatten
|
||||
//#flatMapConcat
|
||||
Flow[Source[Int, Any]].flatMapConcat(identity)
|
||||
//#flatMapConcat
|
||||
|
||||
//#port-async
|
||||
class MapAsyncOne[In, Out](f: In ⇒ Future[Out])(implicit ec: ExecutionContext)
|
||||
|
|
@ -71,7 +71,7 @@ Example
|
|||
|
||||
should be replaced by
|
||||
|
||||
.. includecode:: code/docs/Migrations.scala#flow-wrap
|
||||
.. includecode:: code/docs/MigrationsScala.scala#flow-wrap
|
||||
|
||||
and
|
||||
|
||||
|
|
@ -90,7 +90,7 @@ and
|
|||
|
||||
Should be replaced by
|
||||
|
||||
.. includecode:: code/docs/Migrations.scala#bidiflow-wrap
|
||||
.. includecode:: code/docs/MigrationsScala.scala#bidiflow-wrap
|
||||
|
||||
FlowGraph builder methods have been renamed
|
||||
===========================================
|
||||
|
|
@ -123,7 +123,7 @@ Example
|
|||
|
||||
should be replaced by
|
||||
|
||||
.. includecode:: code/docs/Migrations.scala#graph-create
|
||||
.. includecode:: code/docs/MigrationsScala.scala#graph-create
|
||||
|
||||
Methods that create Source, Sink, Flow from Graphs have been removed
|
||||
====================================================================
|
||||
|
|
@ -180,7 +180,7 @@ Example
|
|||
|
||||
should be replaced by
|
||||
|
||||
.. includecode:: code/docs/Migrations.scala#graph-create-2
|
||||
.. includecode:: code/docs/MigrationsScala.scala#graph-create-2
|
||||
|
||||
Several Graph builder methods have been removed
|
||||
===============================================
|
||||
|
|
@ -213,7 +213,7 @@ Example
|
|||
|
||||
should be replaced by
|
||||
|
||||
.. includecode:: code/docs/Migrations.scala#graph-edges
|
||||
.. includecode:: code/docs/MigrationsScala.scala#graph-edges
|
||||
|
||||
Source constructor name changes
|
||||
===============================
|
||||
|
|
@ -249,7 +249,7 @@ Example
|
|||
|
||||
should be replaced by
|
||||
|
||||
.. includecode:: code/docs/Migrations.scala#source-creators
|
||||
.. includecode:: code/docs/MigrationsScala.scala#source-creators
|
||||
|
||||
``flatten(FlattenStrategy)`` has been replaced by named counterparts
|
||||
====================================================================
|
||||
|
|
@ -260,7 +260,8 @@ has been removed and replaced with the alternative method ``flatten(FlattenStrat
|
|||
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 all occurrences of ``map(f).flatMapConcat(identity)`` with ``flatMapConcat(f)``
|
||||
|
||||
Example
|
||||
^^^^^^^
|
||||
|
|
@ -272,7 +273,7 @@ Example
|
|||
|
||||
should be replaced by
|
||||
|
||||
.. includecode:: code/docs/Migrations.scala#flatten
|
||||
.. includecode:: code/docs/MigrationsScala.scala#flatMapConcat
|
||||
|
||||
FlexiMerge an FlexiRoute has been replaced by GraphStage
|
||||
========================================================
|
||||
|
|
@ -408,4 +409,4 @@ Example
|
|||
|
||||
should be replaced by
|
||||
|
||||
.. includecode:: code/docs/Migrations.scala#port-async
|
||||
.. includecode:: code/docs/MigrationsScala.scala#port-async
|
||||
Loading…
Add table
Add a link
Reference in a new issue