I want to write an asynchronous method that returns a CompletableFuture. The only purpose of the future is to track when the method is complete, not its result. Would it be bett
It is best to use CompletableFuture
.
According to this answer found by Sotirios Delimanolis, Future>
is a minor API flaw. In Java 6 the submit()
method used a Future
internally, and so its return type was set to Future>
. In Java 7 the implementation changed to use Future
internally, but it was too late to change the API so the return value stayed as Future>
.
Newer Java APIs use Future
and CompletableFuture
. Those are the examples we should follow.