#19441: Use Optional instead of Option in javadsl
This commit is contained in:
parent
ecc916abfd
commit
7a39063f2e
7 changed files with 48 additions and 68 deletions
|
|
@ -3,18 +3,16 @@
|
|||
*/
|
||||
package akka.stream.javadsl
|
||||
|
||||
import java.io.{ InputStream, OutputStream, File }
|
||||
import java.util.Optional
|
||||
|
||||
import akka.actor.{ ActorRef, Props }
|
||||
import akka.dispatch.ExecutionContexts
|
||||
import akka.japi.function
|
||||
import akka.stream.impl.Stages.DefaultAttributes
|
||||
import akka.stream.impl.StreamLayout
|
||||
import akka.stream.{ javadsl, scaladsl, _ }
|
||||
import akka.util.ByteString
|
||||
import org.reactivestreams.{ Publisher, Subscriber }
|
||||
|
||||
import scala.concurrent.duration.FiniteDuration
|
||||
import scala.compat.java8.OptionConverters._
|
||||
import scala.concurrent.{ ExecutionContext, Future }
|
||||
import scala.util.Try
|
||||
|
||||
|
|
@ -110,9 +108,9 @@ object Sink {
|
|||
*
|
||||
* See also [[head]].
|
||||
*/
|
||||
def headOption[In](): Sink[In, Future[akka.japi.Option[In]]] =
|
||||
def headOption[In](): Sink[In, Future[Optional[In]]] =
|
||||
new Sink(scaladsl.Sink.headOption[In].mapMaterializedValue(
|
||||
_.map(akka.japi.Option.fromScalaOption)(ExecutionContexts.sameThreadExecutionContext)))
|
||||
_.map(_.asJava)(ExecutionContexts.sameThreadExecutionContext)))
|
||||
|
||||
/**
|
||||
* A `Sink` that materializes into a `Future` of the last value received.
|
||||
|
|
@ -131,9 +129,9 @@ object Sink {
|
|||
*
|
||||
* See also [[head]].
|
||||
*/
|
||||
def lastOption[In](): Sink[In, Future[akka.japi.Option[In]]] =
|
||||
def lastOption[In](): Sink[In, Future[Optional[In]]] =
|
||||
new Sink(scaladsl.Sink.lastOption[In].mapMaterializedValue(
|
||||
_.map(akka.japi.Option.fromScalaOption)(ExecutionContexts.sameThreadExecutionContext)))
|
||||
_.map(_.asJava)(ExecutionContexts.sameThreadExecutionContext)))
|
||||
|
||||
/**
|
||||
* A `Sink` that keeps on collecting incoming elements until upstream terminates.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue