@Test public void testChaining() throws Exception { FutureWithTrigger<Integer> futureWithTrigger = new FutureWithTrigger<>(); int initialValue = 1; Triggerer.triggerValueAsync(10, initialValue, futureWithTrigger); String result = futureWithTrigger.getFuture().mapFuture(i -> { FutureWithTrigger<Integer> next = new FutureWithTrigger<>(); Triggerer.triggerValueAsync(10, initialValue + 1, next); return next.getFuture(); }).map( i -> new StringBuilder(Integer.toString(i)) ).consume( s -> s.append("c") ).await().toString(); assertEquals("2c", result); }
public Future<T> getFuture(){ return this.future; }
FutureWithTrigger { public Future<T> getFuture(){ return this.future; } }
FutureWithTrigger { public Future<T> getFuture(){ return this.future; } FutureWithTrigger(); }
FutureWithTrigger { public Future<T> getFuture(){ return this.future; } FutureWithTrigger(); Callback<T> getTrigger(); Future<T> getFuture(); }
FutureWithTrigger { public Future<T> getFuture(){ return this.future; } FutureWithTrigger(); Callback<T> getTrigger(); Future<T> getFuture();  }