Using values from previously chained thenCompose lambdas in Java 8
问题 The Java 8 coding style preferred by my colleagues is chaining asynchronous calls all the way through, e.g. CompletionStage<E> someMethod() { return doSomething().thenCompose(a -> { // ... return b; }).thenCompose(b -> { // ... return c; }).thenCompose(c -> { // ... return d; }).thenApply(d -> { // ... return e; }); } I have something like the above, but with an added challenge: I need to recall values retrieved within some of the lambdas, in later lambdas. For example, CompletionStage<E>