Last active
May 22, 2021 14:52
-
-
Save ova2/9c2ee96de4d7ca2327b163df7d2989f0 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
CompletableFuture<Void> cf = CompletableFuture.supplyAsync(() -> 1 + 2) | |
.thenApply(i -> "1 + 2 = " + i) | |
.thenAccept(s -> System.out.println("Computation result: " + s)) | |
.thenRun(() -> System.out.println("Finished")); | |
cf.get(); | |
// Output | |
Computation result: 1 + 2 = 3 | |
Finished |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment