Convert CompletableFuture (Java 8) to Future (Scala)

Yes, it's called scala-java8-compat, and here's the method you're looking for.


Though 2.12 was mentioned by asker (in 2017), now we have 2.13 and the conversion has become easier:

Starting Scala 2.13, the standard library includes scala.jdk.FutureConverters which provides Java to Scala CompletableFuture/Future implicit conversions:

import scala.jdk.FutureConverters._

val scalaFuture = javaFuture.asScala

Convert a Java Future to a Scala Future

Tags:

Scala

Java 8