Answers for "java completablefuture chain 2 operations"

0

java completablefuture chain 2 operations

CompletableFuture<User> getUsersDetail(String userId) {
	return CompletableFuture.supplyAsync(() -> {
		return UserService.getUserDetails(userId);
	});	
}

CompletableFuture<Double> getCreditRating(User user) {
	return CompletableFuture.supplyAsync(() -> {
		return CreditRatingService.getCreditRating(user);
	});
}
Posted by: Guest on May-14-2021
0

java completablefuture chain 2 operations

CompletableFuture<CompletableFuture<Double>> result = getUserDetail(userId)
.thenApply(user -> getCreditRating(user));
Posted by: Guest on May-14-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language