Created
May 11, 2018 03:28
-
-
Save vichu/35bab9e8b8b0073c008fc1588eba6dca to your computer and use it in GitHub Desktop.
compose and combine CompletableFutures
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CompletableFuture<Map<String, Object>> myObjectCompletableFuture = | |
myCompletableFutureBigDecimal.thenCompose(bigDecimalValue -> | |
myCompletableFutureInt | |
.thenCombine(myCompletableFutureLong, | |
((integerValue, longValue) -> { | |
Map<String, Object> objectHashMap = new HashMap<>(); | |
objectHashMap.put("IntegerValue", integerValue); | |
objectHashMap.put("LongValue", longValue); | |
objectHashMap.put("BigDecimalValue", bigDecimalValue); | |
return objectHashMap; | |
}))); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment