Skip to content

Instantly share code, notes, and snippets.

@john-nash-rs
Created April 26, 2020 09:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save john-nash-rs/5c0c8a6a21c8e5d71560b18c02ae4a00 to your computer and use it in GitHub Desktop.
Save john-nash-rs/5c0c8a6a21c8e5d71560b18c02ae4a00 to your computer and use it in GitHub Desktop.
private static void demoThenAccept() {
CompletableFuture<String> completableFuture = CompletableFuture.supplyAsync(() -> {
System.out.println("Task Running inside completable Future");
return "returned result";
});
CompletableFuture<Void> secondCompletableFuture = completableFuture.thenAccept(result -> {
System.out.println("I am the "+result);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment