Skip to content

Instantly share code, notes, and snippets.

@PatrickGopher
Created July 17, 2020 06:18
Show Gist options
  • Save PatrickGopher/3ed09ee5924cbbb49a8653eeb9804bb0 to your computer and use it in GitHub Desktop.
Save PatrickGopher/3ed09ee5924cbbb49a8653eeb9804bb0 to your computer and use it in GitHub Desktop.
final var a = 10;
CompletableFuture<Void> future = CompletableFuture
.supplyAsync(() -> a * (a + 1))
.exceptionally(ex -> {
System.out.println("err: " + ex.toString());
return 0;
})
.thenApply(i -> Integer.toString(i))
.thenApply(str -> "\"" + str + "\"")
.thenAccept(System.out::println);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment