Created
March 26, 2018 12:03
-
-
Save jasmine-k/5bf65986cd7b0d124d2fb158170c59d1 to your computer and use it in GitHub Desktop.
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
private static void chainOfThenApply() { | |
CompletableFuture.supplyAsync(() -> { | |
// Code which might throw an exception | |
return "Some result"; | |
}).thenApply(result -> { | |
return "processed result"; | |
}).thenApply(result -> { | |
return "result after further processing"; | |
}).thenAccept(result -> { | |
// do something with the final result | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment