445f747ce3
Motivation: Making futures easier to compose, combine, and extend is useful to have as part of the API, since implementing this correctly and efficiently can be tricky. Modification: Add `Future.map(Function<V,R>) -> Future<R>` and `Future.flatMap(Function<V,Future<R>>) -> Future<R>` default methods to the `Future` interface. These methods return new Future instance, that will be completed when the original future completes, and the result will be processed through the given mapping function. These two methods take care to propagate cancellation and exceptions correctly: Cancellation propagates both ways between the new and original future. Failures only propagate from the original future to the returned new Future instance. Result: A few convenient methods for modifying and composing futures. This PR fixes #8523, and perhaps also #2105 |
||
---|---|---|
.. | ||
src | ||
pom.xml |