RFR 8005696: Add CompletableFuture - JEP 155

Doug Lea dl at cs.oswego.edu
Wed Mar 27 19:46:55 UTC 2013

On 03/23/13 07:08, Doug Lea wrote:
> There was a signature mismatch between the public
>    public static CompletableFuture<Void> anyOf(CompletableFuture<?>... cfs)
> and the internal method performing most of the work:
>    private static CompletableFuture<?> anyTree(...)
> ("<Void>" and "<?>" are subtly different.)

Thanks to Martin especially for knocking some sense into me
about this. The type signature *was* incompatible, but
changing to <Void> rather the <Object> made this updated
version less useful (it could only return indication, not
result). So it is now updated with a signature-correct
version of anyOf with its original semantics.

Additionally, while being slightly disruptive anyway:
This class was lacking a little convenience method found in
other Future-based frameworks that surely will be requested.
So now added:

      * Returns a new CompletableFuture that is already completed with
      * the given value.
      * @param value the value
      * @return the completed CompletableFuture
     public static <U> CompletableFuture<U> completedFuture(U value)

More information about the core-libs-dev mailing list