@@ -20,7 +20,7 @@ import java.util.concurrent.{ CompletableFuture, CompletionStage }
2020import scala .annotation .{ nowarn , varargs }
2121import scala .annotation .unchecked .uncheckedVariance
2222import scala .collection .immutable
23- import scala .concurrent .{ Future , Promise }
23+ import scala .concurrent .Promise
2424import scala .concurrent .ExecutionContext
2525import scala .jdk .CollectionConverters ._
2626import scala .jdk .DurationConverters ._
@@ -311,15 +311,6 @@ object Source {
311311 def failed [T ](cause : Throwable ): Source [T , NotUsed ] =
312312 new Source (scaladsl.Source .failed(cause))
313313
314- /**
315- * Emits a single value when the given Scala `Future` is successfully completed and then completes the stream.
316- * The stream fails if the `Future` is completed with a failure.
317- *
318- * Here for Java interoperability, the normal use from Java should be [[Source.completionStage ]]
319- */
320- def future [T ](futureElement : Future [T ]): Source [T , NotUsed ] =
321- scaladsl.Source .future(futureElement).asJava
322-
323314 /**
324315 * Never emits any elements, never completes and never fails.
325316 * This stream could be useful in tests.
@@ -332,7 +323,7 @@ object Source {
332323 * If the `CompletionStage` is completed with a failure the stream is failed.
333324 */
334325 def completionStage [T ](completionStage : CompletionStage [T ]): Source [T , NotUsed ] =
335- future(completionStage.asScala)
326+ new Source (scaladsl. Source . future(completionStage.asScala) )
336327
337328 /**
338329 * Turn a `CompletionStage[Source]` into a source that will emit the values of the source when the future completes successfully.
0 commit comments