Skip to content
Advertisement

Tag: future

How to return a value from a nested CompletableFuture without blocking?

I’m having trouble returning car price value using getPrice() method because of the following error: I want getPrice return CompletableFuture<Double> but instead it returns CompletableFuture<CompletableFuture<Double>> because I’m returning a value from a nested future. I could call .join() on the nested future but I don’t want to block the thread. This is my code: Answer The operation you’re looking for

Advertisement