CompletableFuture

Remi Forax forax at univ-mlv.fr
Wed Nov 28 08:09:24 PST 2012


On 11/28/2012 04:07 PM, Doug Lea wrote:
> On 11/27/12 17:01, Remi Forax wrote:
>
>>>     /**
>>>      * Performs the given action with the result of this
>>>      * CompletableFuture if/when it completes normally.
>>>      *
>>>      * @return this CompletableFuture, for convenience
>>>      */
>>>     public CompletableFuture<T> then(Block<? super T> action);
>>
>> The result should be a Completable<?> not a CompletableFuture<T>, 
>> right ?
>
> The void completion methods don't return new CompletableFuture (no need)
> but just "return this" to be nice to fluency fans.

aaaaaah,
It means that with
   CompletableFuture<T> c = completableFuture.then(e -> foo(e));
c.isDone() can be true even if foo() has still not finished.

Having a fluent interface is a nice trick but here, the resulting 
semantics is too weird IMO.

>
> -Doug
>

Rémi



More information about the lambda-libs-spec-observers mailing list