Suppose I have a situation where I call two Repositories to get items.
CompletableFuture<Optional<Account>> accountCompleteableFuture = CompletableFuture.supplyAsync(() ->AccountRepository.findById(accountId));
CompletableFuture<Optional<User>> userCompletableFuture = CompletableFuture.supplyAsync(() ->userRepository.findById(userId));
How Can I get a feedback when both are done brining back the results ? Traditionally I would call both one by one and then do the remaining logic. Here I want to speed up the process . I was trying to do something like thenCombine() ,but both are different Objects and I cannot write the logic in inside that lambda. Can any one suggest better way to do it?