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