/** * Maps the result of this promise to a promise for a result of type <code>B</code>, and * flattens that to be a single promise for <code>B</code>. * * @param function The function to map <code>A</code> to a promise for <code>B</code>. * @param ec The ExecutionContext to execute the function in. * @return A wrapped promise for a result of type <code>B</code> */ public <B> Promise<B> flatMap( final Function<? super A, Promise<B>> function, ExecutionContext ec) { return FPromiseHelper.flatMap(this, function, ec); }
/** * Maps the result of this promise to a promise for a result of type <code>B</code>, and * flattens that to be a single promise for <code>B</code>. * * <p>The function will be run in the default execution context. * * @param function The function to map <code>A</code> to a promise for <code>B</code>. * @return A wrapped promise for a result of type <code>B</code> */ public <B> Promise<B> flatMap(final Function<? super A, Promise<B>> function) { return FPromiseHelper.flatMap(this, function, HttpExecution.defaultContext()); }