replace unicode arrows
* ⇒, →, ← * because we don't want to show them in documentation snippets and then it's complicated to avoid that when snippets are located in src/test/scala in individual modules * dont replace object `→` in FSM.scala and PersistentFSM.scala
This commit is contained in:
parent
e4d38f92a4
commit
5c96a5f556
1521 changed files with 18846 additions and 18786 deletions
|
|
@ -58,7 +58,7 @@ object Source {
|
|||
* with an empty Optional.
|
||||
*/
|
||||
def maybe[T]: Source[T, CompletableFuture[Optional[T]]] = {
|
||||
new Source(scaladsl.Source.maybe[T].mapMaterializedValue { scalaOptionPromise: Promise[Option[T]] ⇒
|
||||
new Source(scaladsl.Source.maybe[T].mapMaterializedValue { scalaOptionPromise: Promise[Option[T]] =>
|
||||
val javaOptionPromise = new CompletableFuture[Optional[T]]()
|
||||
scalaOptionPromise.completeWith(
|
||||
javaOptionPromise.toScala
|
||||
|
|
@ -98,7 +98,7 @@ object Source {
|
|||
* steps.
|
||||
*/
|
||||
def fromIterator[O](f: function.Creator[java.util.Iterator[O]]): javadsl.Source[O, NotUsed] =
|
||||
new Source(scaladsl.Source.fromIterator(() ⇒ f.create().asScala))
|
||||
new Source(scaladsl.Source.fromIterator(() => f.create().asScala))
|
||||
|
||||
/**
|
||||
* Helper to create 'cycled' [[Source]] from iterator provider.
|
||||
|
|
@ -112,7 +112,7 @@ object Source {
|
|||
* will continue infinitely by repeating the sequence of elements provided by function parameter.
|
||||
*/
|
||||
def cycle[O](f: function.Creator[java.util.Iterator[O]]): javadsl.Source[O, NotUsed] =
|
||||
new Source(scaladsl.Source.cycle(() ⇒ f.create().asScala))
|
||||
new Source(scaladsl.Source.cycle(() => f.create().asScala))
|
||||
|
||||
/**
|
||||
* Helper to create [[Source]] from `Iterable`.
|
||||
|
|
@ -245,7 +245,7 @@ object Source {
|
|||
* a pair of the next state `S` and output elements of type `E`.
|
||||
*/
|
||||
def unfold[S, E](s: S, f: function.Function[S, Optional[Pair[S, E]]]): Source[E, NotUsed] =
|
||||
new Source(scaladsl.Source.unfold(s)((s: S) ⇒ f.apply(s).asScala.map(_.toScala)))
|
||||
new Source(scaladsl.Source.unfold(s)((s: S) => f.apply(s).asScala.map(_.toScala)))
|
||||
|
||||
/**
|
||||
* Same as [[unfold]], but uses an async function to generate the next state-element tuple.
|
||||
|
|
@ -253,7 +253,7 @@ object Source {
|
|||
def unfoldAsync[S, E](s: S, f: function.Function[S, CompletionStage[Optional[Pair[S, E]]]]): Source[E, NotUsed] =
|
||||
new Source(
|
||||
scaladsl.Source.unfoldAsync(s)(
|
||||
(s: S) ⇒ f.apply(s).toScala.map(_.asScala.map(_.toScala))(akka.dispatch.ExecutionContexts.sameThreadExecutionContext)))
|
||||
(s: S) => f.apply(s).toScala.map(_.asScala.map(_.toScala))(akka.dispatch.ExecutionContexts.sameThreadExecutionContext)))
|
||||
|
||||
/**
|
||||
* Create a `Source` that immediately ends the stream with the `cause` failure to every connected `Sink`.
|
||||
|
|
@ -267,7 +267,7 @@ object Source {
|
|||
* `create` factory is never called and the materialized `CompletionStage` is failed.
|
||||
*/
|
||||
def lazily[T, M](create: function.Creator[Source[T, M]]): Source[T, CompletionStage[M]] =
|
||||
scaladsl.Source.lazily[T, M](() ⇒ create.create().asScala).mapMaterializedValue(_.toJava).asJava
|
||||
scaladsl.Source.lazily[T, M](() => create.create().asScala).mapMaterializedValue(_.toJava).asJava
|
||||
|
||||
/**
|
||||
* Creates a `Source` from supplied future factory that is not called until downstream demand. When source gets
|
||||
|
|
@ -277,7 +277,7 @@ object Source {
|
|||
* @see [[Source.lazily]]
|
||||
*/
|
||||
def lazilyAsync[T](create: function.Creator[CompletionStage[T]]): Source[T, Future[NotUsed]] =
|
||||
scaladsl.Source.lazilyAsync[T](() ⇒ create.create().toScala).asJava
|
||||
scaladsl.Source.lazilyAsync[T](() => create.create().toScala).asJava
|
||||
|
||||
/**
|
||||
* Creates a `Source` that is materialized as a [[org.reactivestreams.Subscriber]]
|
||||
|
|
@ -342,9 +342,9 @@ object Source {
|
|||
*/
|
||||
def fromGraph[T, M](g: Graph[SourceShape[T], M]): Source[T, M] =
|
||||
g match {
|
||||
case s: Source[T, M] ⇒ s
|
||||
case s if s eq scaladsl.Source.empty ⇒ empty().asInstanceOf[Source[T, M]]
|
||||
case other ⇒ new Source(scaladsl.Source.fromGraph(other))
|
||||
case s: Source[T, M] => s
|
||||
case s if s eq scaladsl.Source.empty => empty().asInstanceOf[Source[T, M]]
|
||||
case other => new Source(scaladsl.Source.fromGraph(other))
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -353,7 +353,7 @@ object Source {
|
|||
def combine[T, U](first: Source[T, _ <: Any], second: Source[T, _ <: Any], rest: java.util.List[Source[T, _ <: Any]],
|
||||
strategy: function.Function[java.lang.Integer, _ <: Graph[UniformFanInShape[T, U], NotUsed]]): Source[U, NotUsed] = {
|
||||
val seq = if (rest != null) Util.immutableSeq(rest).map(_.asScala) else immutable.Seq()
|
||||
new Source(scaladsl.Source.combine(first.asScala, second.asScala, seq: _*)(num ⇒ strategy.apply(num)))
|
||||
new Source(scaladsl.Source.combine(first.asScala, second.asScala, seq: _*)(num => strategy.apply(num)))
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -362,7 +362,7 @@ object Source {
|
|||
def combineMat[T, U, M1, M2, M](first: Source[T, M1], second: Source[T, M2],
|
||||
strategy: function.Function[java.lang.Integer, _ <: Graph[UniformFanInShape[T, U], NotUsed]],
|
||||
combine: function.Function2[M1, M2, M]): Source[U, M] = {
|
||||
new Source(scaladsl.Source.combineMat(first.asScala, second.asScala)(num ⇒ strategy.apply(num))(combinerToScala(combine)))
|
||||
new Source(scaladsl.Source.combineMat(first.asScala, second.asScala)(num => strategy.apply(num))(combinerToScala(combine)))
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -378,7 +378,7 @@ object Source {
|
|||
*/
|
||||
def zipWithN[T, O](zipper: function.Function[java.util.List[T], O], sources: java.util.List[Source[T, _ <: Any]]): Source[O, NotUsed] = {
|
||||
val seq = if (sources != null) Util.immutableSeq(sources).map(_.asScala) else immutable.Seq()
|
||||
new Source(scaladsl.Source.zipWithN[T, O](seq ⇒ zipper.apply(seq.asJava))(seq))
|
||||
new Source(scaladsl.Source.zipWithN[T, O](seq => zipper.apply(seq.asJava))(seq))
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -448,7 +448,7 @@ object Source {
|
|||
close: function.Procedure[S]): javadsl.Source[T, NotUsed] =
|
||||
new Source(scaladsl.Source.unfoldResource[T, S](
|
||||
create.create _,
|
||||
(s: S) ⇒ read.apply(s).asScala, close.apply))
|
||||
(s: S) => read.apply(s).asScala, close.apply))
|
||||
|
||||
/**
|
||||
* Start a new `Source` from some resource which can be opened, read and closed.
|
||||
|
|
@ -475,9 +475,9 @@ object Source {
|
|||
read: function.Function[S, CompletionStage[Optional[T]]],
|
||||
close: function.Function[S, CompletionStage[Done]]): javadsl.Source[T, NotUsed] =
|
||||
new Source(scaladsl.Source.unfoldResourceAsync[T, S](
|
||||
() ⇒ create.create().toScala,
|
||||
(s: S) ⇒ read.apply(s).toScala.map(_.asScala)(akka.dispatch.ExecutionContexts.sameThreadExecutionContext),
|
||||
(s: S) ⇒ close.apply(s).toScala))
|
||||
() => create.create().toScala,
|
||||
(s: S) => read.apply(s).toScala.map(_.asScala)(akka.dispatch.ExecutionContexts.sameThreadExecutionContext),
|
||||
(s: S) => close.apply(s).toScala))
|
||||
|
||||
/**
|
||||
* Upcast a stream of elements to a stream of supertypes of that element. Useful in combination with
|
||||
|
|
@ -1206,7 +1206,7 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[
|
|||
* '''Cancels when''' downstream cancels
|
||||
*/
|
||||
def zipWithIndex: javadsl.Source[Pair[Out @uncheckedVariance, java.lang.Long], Mat] =
|
||||
new Source(delegate.zipWithIndex.map { case (elem, index) ⇒ Pair[Out, java.lang.Long](elem, index) })
|
||||
new Source(delegate.zipWithIndex.map { case (elem, index) => Pair[Out, java.lang.Long](elem, index) })
|
||||
|
||||
/**
|
||||
* Shortcut for running this `Source` with a foreach procedure. The given procedure is invoked
|
||||
|
|
@ -1297,7 +1297,7 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[
|
|||
@deprecated("Use recoverWithRetries instead.", "2.4.4")
|
||||
def recover(clazz: Class[_ <: Throwable], supplier: Supplier[Out]): javadsl.Source[Out, Mat] =
|
||||
recover {
|
||||
case elem if clazz.isInstance(elem) ⇒ supplier.get()
|
||||
case elem if clazz.isInstance(elem) => supplier.get()
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1367,7 +1367,7 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[
|
|||
*/
|
||||
def recoverWith(clazz: Class[_ <: Throwable], supplier: Supplier[Graph[SourceShape[Out], NotUsed]]): Source[Out, Mat] =
|
||||
recoverWith {
|
||||
case elem if clazz.isInstance(elem) ⇒ supplier.get()
|
||||
case elem if clazz.isInstance(elem) => supplier.get()
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1424,7 +1424,7 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[
|
|||
*/
|
||||
def recoverWithRetries(attempts: Int, clazz: Class[_ <: Throwable], supplier: Supplier[Graph[SourceShape[Out], NotUsed]]): Source[Out, Mat] =
|
||||
recoverWithRetries(attempts, {
|
||||
case elem if clazz.isInstance(elem) ⇒ supplier.get()
|
||||
case elem if clazz.isInstance(elem) => supplier.get()
|
||||
})
|
||||
|
||||
/**
|
||||
|
|
@ -1449,7 +1449,7 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[
|
|||
* '''Cancels when''' downstream cancels
|
||||
*/
|
||||
def mapConcat[T](f: function.Function[Out, _ <: java.lang.Iterable[T]]): javadsl.Source[T, Mat] =
|
||||
new Source(delegate.mapConcat(elem ⇒ Util.immutableSeq(f.apply(elem))))
|
||||
new Source(delegate.mapConcat(elem => Util.immutableSeq(f.apply(elem))))
|
||||
|
||||
/**
|
||||
* Transform each input element into an `Iterable` of output elements that is
|
||||
|
|
@ -1478,9 +1478,9 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[
|
|||
* '''Cancels when''' downstream cancels
|
||||
*/
|
||||
def statefulMapConcat[T](f: function.Creator[function.Function[Out, java.lang.Iterable[T]]]): javadsl.Source[T, Mat] =
|
||||
new Source(delegate.statefulMapConcat { () ⇒
|
||||
new Source(delegate.statefulMapConcat { () =>
|
||||
val fun = f.create()
|
||||
elem ⇒ Util.immutableSeq(fun(elem))
|
||||
elem => Util.immutableSeq(fun(elem))
|
||||
})
|
||||
|
||||
/**
|
||||
|
|
@ -1515,7 +1515,7 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[
|
|||
* @see [[#mapAsyncUnordered]]
|
||||
*/
|
||||
def mapAsync[T](parallelism: Int, f: function.Function[Out, CompletionStage[T]]): javadsl.Source[T, Mat] =
|
||||
new Source(delegate.mapAsync(parallelism)(x ⇒ f(x).toScala))
|
||||
new Source(delegate.mapAsync(parallelism)(x => f(x).toScala))
|
||||
|
||||
/**
|
||||
* Transform this stream by applying the given function to each of the elements
|
||||
|
|
@ -1549,7 +1549,7 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[
|
|||
* @see [[#mapAsync]]
|
||||
*/
|
||||
def mapAsyncUnordered[T](parallelism: Int, f: function.Function[Out, CompletionStage[T]]): javadsl.Source[T, Mat] =
|
||||
new Source(delegate.mapAsyncUnordered(parallelism)(x ⇒ f(x).toScala))
|
||||
new Source(delegate.mapAsyncUnordered(parallelism)(x => f(x).toScala))
|
||||
|
||||
/**
|
||||
* Use the `ask` pattern to send a request-reply message to the target `ref` actor.
|
||||
|
|
@ -1838,7 +1838,7 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[
|
|||
* See also [[FlowOps.scan]]
|
||||
*/
|
||||
def scanAsync[T](zero: T)(f: function.Function2[T, Out, CompletionStage[T]]): javadsl.Source[T, Mat] =
|
||||
new Source(delegate.scanAsync(zero) { (out, in) ⇒ f(out, in).toScala })
|
||||
new Source(delegate.scanAsync(zero) { (out, in) => f(out, in).toScala })
|
||||
|
||||
/**
|
||||
* Similar to `scan` but only emits its result when the upstream completes,
|
||||
|
|
@ -1885,7 +1885,7 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[
|
|||
*
|
||||
* '''Cancels when''' downstream cancels
|
||||
*/
|
||||
def foldAsync[T](zero: T)(f: function.Function2[T, Out, CompletionStage[T]]): javadsl.Source[T, Mat] = new Source(delegate.foldAsync(zero) { (out, in) ⇒ f(out, in).toScala })
|
||||
def foldAsync[T](zero: T)(f: function.Function2[T, Out, CompletionStage[T]]): javadsl.Source[T, Mat] = new Source(delegate.foldAsync(zero) { (out, in) => f(out, in).toScala })
|
||||
|
||||
/**
|
||||
* Similar to `fold` but uses first element as zero element.
|
||||
|
|
@ -2419,7 +2419,7 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[
|
|||
* @see [[#extrapolate]]
|
||||
*/
|
||||
def expand[U](expander: function.Function[Out, java.util.Iterator[U]]): javadsl.Source[U, Mat] =
|
||||
new Source(delegate.expand(in ⇒ expander(in).asScala))
|
||||
new Source(delegate.expand(in => expander(in).asScala))
|
||||
|
||||
/**
|
||||
* Allows a faster downstream to progress independent of a slower upstream.
|
||||
|
|
@ -2446,7 +2446,7 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[
|
|||
* @see [[#expand]]
|
||||
*/
|
||||
def extrapolate(extrapolator: function.Function[Out @uncheckedVariance, java.util.Iterator[Out @uncheckedVariance]]): Source[Out, Mat] =
|
||||
new Source(delegate.extrapolate(in ⇒ extrapolator(in).asScala))
|
||||
new Source(delegate.extrapolate(in => extrapolator(in).asScala))
|
||||
|
||||
/**
|
||||
* Allows a faster downstream to progress independent of a slower upstream.
|
||||
|
|
@ -2474,7 +2474,7 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[
|
|||
* @see [[#expand]]
|
||||
*/
|
||||
def extrapolate(extrapolator: function.Function[Out @uncheckedVariance, java.util.Iterator[Out @uncheckedVariance]], initial: Out @uncheckedVariance): Source[Out, Mat] =
|
||||
new Source(delegate.extrapolate(in ⇒ extrapolator(in).asScala, Some(initial)))
|
||||
new Source(delegate.extrapolate(in => extrapolator(in).asScala, Some(initial)))
|
||||
|
||||
/**
|
||||
* Adds a fixed size buffer in the flow that allows to store elements from a faster upstream until it becomes full.
|
||||
|
|
@ -2522,7 +2522,7 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[
|
|||
* '''Cancels when''' downstream cancels or substream cancels
|
||||
*/
|
||||
def prefixAndTail(n: Int): javadsl.Source[Pair[java.util.List[Out @uncheckedVariance], javadsl.Source[Out @uncheckedVariance, NotUsed]], Mat] =
|
||||
new Source(delegate.prefixAndTail(n).map { case (taken, tail) ⇒ Pair(taken.asJava, tail.asJava) })
|
||||
new Source(delegate.prefixAndTail(n).map { case (taken, tail) => Pair(taken.asJava, tail.asJava) })
|
||||
|
||||
/**
|
||||
* This operation demultiplexes the incoming stream into separate output
|
||||
|
|
@ -2759,7 +2759,7 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[
|
|||
* '''Cancels when''' downstream cancels
|
||||
*/
|
||||
def flatMapConcat[T, M](f: function.Function[Out, _ <: Graph[SourceShape[T], M]]): Source[T, Mat] =
|
||||
new Source(delegate.flatMapConcat[T, M](x ⇒ f(x)))
|
||||
new Source(delegate.flatMapConcat[T, M](x => f(x)))
|
||||
|
||||
/**
|
||||
* Transform each input element into a `Source` of output elements that is
|
||||
|
|
@ -2775,7 +2775,7 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[
|
|||
* '''Cancels when''' downstream cancels
|
||||
*/
|
||||
def flatMapMerge[T, M](breadth: Int, f: function.Function[Out, _ <: Graph[SourceShape[T], M]]): Source[T, Mat] =
|
||||
new Source(delegate.flatMapMerge(breadth, o ⇒ f(o)))
|
||||
new Source(delegate.flatMapMerge(breadth, o => f(o)))
|
||||
|
||||
/**
|
||||
* If the first element has not passed through this operator before the provided timeout, the stream is failed
|
||||
|
|
@ -2929,7 +2929,7 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[
|
|||
@Deprecated
|
||||
@deprecated("Use the overloaded one which accepts java.time.Duration instead.", since = "2.5.12")
|
||||
def keepAlive(maxIdle: FiniteDuration, injectedElem: function.Creator[Out]): javadsl.Source[Out, Mat] =
|
||||
new Source(delegate.keepAlive(maxIdle, () ⇒ injectedElem.create()))
|
||||
new Source(delegate.keepAlive(maxIdle, () => injectedElem.create()))
|
||||
|
||||
/**
|
||||
* Injects additional elements if upstream does not emit for a configured amount of time. In other words, this
|
||||
|
|
@ -3233,7 +3233,7 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[
|
|||
@Deprecated
|
||||
@deprecated("Use throttle without `maximumBurst` parameter instead.", "2.5.12")
|
||||
def throttleEven(cost: Int, per: FiniteDuration,
|
||||
costCalculation: (Out) ⇒ Int, mode: ThrottleMode): javadsl.Source[Out, Mat] =
|
||||
costCalculation: (Out) => Int, mode: ThrottleMode): javadsl.Source[Out, Mat] =
|
||||
new Source(delegate.throttleEven(cost, per, costCalculation.apply _, mode))
|
||||
|
||||
/**
|
||||
|
|
@ -3249,7 +3249,7 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[
|
|||
@Deprecated
|
||||
@deprecated("Use throttle without `maximumBurst` parameter instead.", "2.5.12")
|
||||
def throttleEven(cost: Int, per: java.time.Duration,
|
||||
costCalculation: (Out) ⇒ Int, mode: ThrottleMode): javadsl.Source[Out, Mat] =
|
||||
costCalculation: (Out) => Int, mode: ThrottleMode): javadsl.Source[Out, Mat] =
|
||||
throttleEven(cost, per.asScala, costCalculation, mode)
|
||||
|
||||
/**
|
||||
|
|
@ -3273,7 +3273,7 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[
|
|||
* downstream.
|
||||
*/
|
||||
def watchTermination[M]()(matF: function.Function2[Mat, CompletionStage[Done], M]): javadsl.Source[Out, M] =
|
||||
new Source(delegate.watchTermination()((left, right) ⇒ matF(left, right.toJava)))
|
||||
new Source(delegate.watchTermination()((left, right) => matF(left, right.toJava)))
|
||||
|
||||
/**
|
||||
* Materializes to `FlowMonitor<Out>` that allows monitoring of the current flow. All events are propagated
|
||||
|
|
@ -3406,7 +3406,7 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[
|
|||
* '''Cancels when''' downstream cancels
|
||||
*/
|
||||
def log(name: String, extract: function.Function[Out, Any], log: LoggingAdapter): javadsl.Source[Out, Mat] =
|
||||
new Source(delegate.log(name, e ⇒ extract.apply(e))(log))
|
||||
new Source(delegate.log(name, e => extract.apply(e))(log))
|
||||
|
||||
/**
|
||||
* Logs elements flowing through the stream as well as completion and erroring.
|
||||
|
|
@ -3473,5 +3473,5 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[
|
|||
*/
|
||||
@ApiMayChange
|
||||
def asSourceWithContext[Ctx](extractContext: function.Function[Out, Ctx]): SourceWithContext[Out, Ctx, Mat] =
|
||||
new scaladsl.SourceWithContext(this.asScala.map(x ⇒ (x, extractContext.apply(x)))).asJava
|
||||
new scaladsl.SourceWithContext(this.asScala.map(x => (x, extractContext.apply(x)))).asJava
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue