Created
April 26, 2020 13:14
-
-
Save john-nash-rs/5ae3d313e6934dc04dc27b975de7b7ad 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 demoCompletableFutureComplete() throws InterruptedException, ExecutionException { | |
CompletableFuture<String> completableFuture = new CompletableFuture<>(); | |
//String value = completableFuture.get(); | |
//The above statement will cause program to run forever. | |
// Because there is nothing for the completable future to do. | |
completableFuture.complete("Completing the completable future with this default text"); | |
String value = completableFuture.get(); | |
System.out.println("Value After Complete: "+value); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment