Source.single
Stream a single object once.
Signature
Description
Stream a single object once and complete after thereafter.
See also:
repeat
Stream a single object repeatedly.tick
A periodical repetition of an arbitrary object.cycle
Stream iterator in cycled manner.
Examples
- Scala
-
source
import akka.stream._ val s: Future[immutable.Seq[Int]] = Source.single(1).runWith(Sink.seq) s.foreach(list => println(s"Collected elements: $list")) // prints: Collected elements: List(1)
- Java
Reactive Streams semantics
emits the value once
completes when the single value has been emitted