說我有一個像下面的情況:如果我在CompletableFuture上使用thenCompose並指定它,我是否有2個CompletableFutures?
CompletableFuture<Object1> f1 = Class1.doSomething();
CompletableFuture<Object2> f2 = Class2.doSomethingElse(f1);
boolean b = doAnotherThing(f2);
凡Class2中使用thenCompose(),並返回一個不同的對象類型
CompletableFuture<Object2> doSomethingElse(CompletableFuture<Object1> f) {
return f.thenCompose(s -> {...});
難道我那麼有2個期貨?我需要做什麼:
CompletableFuture.allOf(f1, f2);
這項任務如何影響未來?
c2從哪裏來? – efekctive
@efekctive對不起,我簡化了它,只是表示Class2。 – Tim