GitHub user pjfanning edited a discussion: Stream JavaDSL: start adding 
alternate methods that use Java function interfaces instead of the Pekko ones

org.apache.pekko.japi.function package is commonly used for functions in our 
javadsl.

We can't just change the existing methods to use the Java built-in Function 
interfaces. (java.util.function package)

@kerr says that we can't add overloaded methods because the Java compiler will 
not be able to distinguish between the 2 overloaded methods when you try to 
provide lamdba functions as inputs.

We have options like
* add new methods with `V2` in the name. An example is Flow.statefulMap which 
takes a Pekko 
[Creator](https://pekko.apache.org/api/pekko/current/org/apache/pekko/japi/function/Creator.html)
 function as its first param. We could add a statefulMapV2 that takes a 
[Supplier](https://docs.oracle.com/javase/8/docs/api/java/util/function/Supplier.html)
 instance instead.
* we could add a javadsl2 package but we would end up duplicating a lot of code 
- a lot of the methods in javadsl will not need to change in javadsl2
  * if someone has the time and the motivation, this still might be a tidier 
solution that adding some 'V2' methods to the existing javadsl 

GitHub link: https://github.com/apache/incubator-pekko/discussions/960

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: 
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to