“Java CompletableFuture Chain 2 Operations” Respostas de código

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

Respostas semelhantes a “Java CompletableFuture Chain 2 Operations”

Perguntas semelhantes a “Java CompletableFuture Chain 2 Operations”

Mais respostas relacionadas para “Java CompletableFuture Chain 2 Operations” em Java

Procure respostas de código populares por idioma

Procurar outros idiomas de código