Convert a Java Future to a Scala Future
问题 I have a Java Future object which I would like to convert into a Scala Future . Looking at the j.u.c.Future API, there is nothing much that I could use other than the isDone method. Is this isDone method blocking? Currently this is what I have in my mind: val p = Promise() if (javaFuture.isDone()) p.success(javaFuture.get) Is there a better way to do this? 回答1: How about just wrapping it (I'm assuming there's an implicit ExecutionContext here): val scalaFuture = Future { javaFuture.get } EDIT