@Test public void biFlatMap() throws CheckedFutureException { Promise<Integer> p = Promise.apply(); Future<Integer> f = p.biFlatMap(Future.value(1), (a, b) -> Future.value(a + b)); p.setValue(1); assertEquals(new Integer(1), get(p)); assertEquals(new Integer(2), get(f)); }
@Override public <U, R> Future<R> biFlatMap(final Future<U> other, final BiFunction<? super T, ? super U, ? extends Future<R>> f) { if (getInterruptHandler() != null) return continuation(new BiFlatMap<T, U, R>(other, f) { @Override protected final InterruptHandler getInterruptHandler() { return InterruptHandler.apply(Promise.this, other); } }); else return continuation(new BiFlatMap<T, U, R>(other, f)); }
Promise implements Future<T> { @Override public <U, R> Future<R> biFlatMap(final Future<U> other, final BiFunction<? super T, ? super U, ? extends Future<R>> f) { if (getInterruptHandler() != null) return continuation(new BiFlatMap<T, U, R>(other, f) { @Override protected final InterruptHandler getInterruptHandler() { return InterruptHandler.apply(Promise.this, other); } }); else return continuation(new BiFlatMap<T, U, R>(other, f)); } }
Promise implements Future<T> { @Override public <U, R> Future<R> biFlatMap(final Future<U> other, final BiFunction<? super T, ? super U, ? extends Future<R>> f) { if (getInterruptHandler() != null) return continuation(new BiFlatMap<T, U, R>(other, f) { @Override protected final InterruptHandler getInterruptHandler() { return InterruptHandler.apply(Promise.this, other); } }); else return continuation(new BiFlatMap<T, U, R>(other, f)); } protected  Promise(); }
Promise implements Future<T> { @Override public <U, R> Future<R> biFlatMap(final Future<U> other, final BiFunction<? super T, ? super U, ? extends Future<R>> f) { if (getInterruptHandler() != null) return continuation(new BiFlatMap<T, U, R>(other, f) { @Override protected final InterruptHandler getInterruptHandler() { return InterruptHandler.apply(Promise.this, other); } }); else return continuation(new BiFlatMap<T, U, R>(other, f)); } protected  Promise(); static final Promise<T> apply(final List<? extends InterruptHandler> handlers); static final Promise<T> apply(final InterruptHandler handler); static final Promise<T> apply(); static final Promise<T> create(final Function<Promise<T>, InterruptHandler> handlerBuilder); final void become(final Future<T> result); final boolean becomeIfEmpty(final Future<T> result); @SuppressWarnings("unchecked") final boolean trySetState(final Future<T> result); final void setValue(final T value); final void setException(final Throwable ex); @SuppressWarnings("unchecked") @Override final void raise(final Throwable ex); @Override Future<T> interruptible(); @SuppressWarnings("unchecked") @Override final boolean isDefined(); @SuppressWarnings("unchecked") @Override final T get(final Duration timeout); @Override final void join(final Duration timeout); @Override final Future<R> map(final Function<? super T, ? extends R> f); @Override final Future<R> flatMap(final Function<? super T, ? extends Future<R>> f); @Override Future<R> transform(final Transformer<? super T, ? extends R> t); @Override Future<R> transformWith(final Transformer<? super T, ? extends Future<R>> t); @Override Future<R> biMap(final Future<U> other, final BiFunction<? super T, ? super U, ? extends R> f); @Override Future<R> biFlatMap(final Future<U> other,
      final BiFunction<? super T, ? super U, ? extends Future<R>> f); @Override final Future<T> ensure(final Runnable f); @Override final Future<T> onSuccess(final Consumer<? super T> c); @Override final Future<T> onFailure(final Consumer<Throwable> c); @Override final Future<T> respond(final Responder<? super T> r); @Override final Future<T> rescue(final Function<Throwable, ? extends Future<T>> f); @Override final Future<Void> voided(); @Override final Future<T> delayed(final Duration delay, final ScheduledExecutorService scheduler); @Override final void proxyTo(final Promise<T> p); @Override final Future<T> within(final Duration timeout, final ScheduledExecutorService scheduler,
      final Throwable exception); @Override final String toString(); }
Promise implements Future<T> { @Override public <U, R> Future<R> biFlatMap(final Future<U> other, final BiFunction<? super T, ? super U, ? extends Future<R>> f) { if (getInterruptHandler() != null) return continuation(new BiFlatMap<T, U, R>(other, f) { @Override protected final InterruptHandler getInterruptHandler() { return InterruptHandler.apply(Promise.this, other); } }); else return continuation(new BiFlatMap<T, U, R>(other, f)); } protected  Promise(); static final Promise<T> apply(final List<? extends InterruptHandler> handlers); static final Promise<T> apply(final InterruptHandler handler); static final Promise<T> apply(); static final Promise<T> create(final Function<Promise<T>, InterruptHandler> handlerBuilder); final void become(final Future<T> result); final boolean becomeIfEmpty(final Future<T> result); @SuppressWarnings("unchecked") final boolean trySetState(final Future<T> result); final void setValue(final T value); final void setException(final Throwable ex); @SuppressWarnings("unchecked") @Override final void raise(final Throwable ex); @Override Future<T> interruptible(); @SuppressWarnings("unchecked") @Override final boolean isDefined(); @SuppressWarnings("unchecked") @Override final T get(final Duration timeout); @Override final void join(final Duration timeout); @Override final Future<R> map(final Function<? super T, ? extends R> f); @Override final Future<R> flatMap(final Function<? super T, ? extends Future<R>> f); @Override Future<R> transform(final Transformer<? super T, ? extends R> t); @Override Future<R> transformWith(final Transformer<? super T, ? extends Future<R>> t); @Override Future<R> biMap(final Future<U> other, final BiFunction<? super T, ? super U, ? extends R> f); @Override Future<R> biFlatMap(final Future<U> other,
      final BiFunction<? super T, ? super U, ? extends Future<R>> f); @Override final Future<T> ensure(final Runnable f); @Override final Future<T> onSuccess(final Consumer<? super T> c); @Override final Future<T> onFailure(final Consumer<Throwable> c); @Override final Future<T> respond(final Responder<? super T> r); @Override final Future<T> rescue(final Function<Throwable, ? extends Future<T>> f); @Override final Future<Void> voided(); @Override final Future<T> delayed(final Duration delay, final ScheduledExecutorService scheduler); @Override final void proxyTo(final Promise<T> p); @Override final Future<T> within(final Duration timeout, final ScheduledExecutorService scheduler,
      final Throwable exception); @Override final String toString();  }