1CompletableFuture<CompletableFuture<Double>> result = getUserDetail(userId)
2.thenApply(user -> getCreditRating(user));
3
1CompletableFuture<User> getUsersDetail(String userId) {
2 return CompletableFuture.supplyAsync(() -> {
3 return UserService.getUserDetails(userId);
4 });
5}
6
7CompletableFuture<Double> getCreditRating(User user) {
8 return CompletableFuture.supplyAsync(() -> {
9 return CreditRatingService.getCreditRating(user);
10 });
11}
12