“Java CompletableFuture Chain 2 Operations” Kode Jawaban

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);
	});
}
Distinct Dog

Java CompletableFuture Chain 2 Operations

CompletableFuture<CompletableFuture<Double>> result = getUserDetail(userId)
.thenApply(user -> getCreditRating(user));
Distinct Dog

Jawaban yang mirip dengan “Java CompletableFuture Chain 2 Operations”

Pertanyaan yang mirip dengan “Java CompletableFuture Chain 2 Operations”

Lebih banyak jawaban terkait untuk “Java CompletableFuture Chain 2 Operations” di Java

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya