Provide the Future#flatMap method as alias of Future#compose method - closes #3145

This commit is contained in:
Julien Viet
2019-10-02 22:24:37 +02:00
parent 95f82b52bd
commit ceb1bf116b

View File

@@ -150,6 +150,13 @@ public interface Future<T> extends AsyncResult<T> {
@Override
boolean failed();
/**
* Alias for {@link #compose(Function)}.
*/
default <U> Future<U> flatMap(Function<T, Future<U>> mapper) {
return compose(mapper);
}
/**
* Compose this future with a {@code mapper} function.<p>
*