The Future ist nicht vollständig?

object Executor extends App {
  implicit val system = ActorSystem()
  implicit val materializer = ActorMaterializer()
  implicit val ec = system.dispatcher
  import akka.stream.io._
  val file = new File("res/AdviceAnimals.tsv")
  import akka.stream.io.Implicits._
  val foreach: Future[Long] = SynchronousFileSource(file)
    .to( Sink.outputStream(()=>System.out))
    .run()

  foreach onComplete { v =>
    println(s"the foreach is ${v.get}")  // the will not be print
  }
}

aber wenn ich das @ ändeSink.outputStream(()=>System.out) zuSink.ignore, dasprintln(s"the foreach is ${v.get}") wird gedruckt.

ann jemand erklären, waru

Antworten auf die Frage(4)

Ihre Antwort auf die Frage