Skip to content

Instantly share code, notes, and snippets.

@theboreddev
Created June 30, 2020 21:27
Show Gist options
  • Save theboreddev/1b1e810c125be061178eef5d70289cb4 to your computer and use it in GitHub Desktop.
Save theboreddev/1b1e810c125be061178eef5d70289cb4 to your computer and use it in GitHub Desktop.
exceptionally
CompletableFuture<Result> chain = CompletableFuture.runAsync(() -> System.out.println("Start"))
.thenCombine(subTask, (nil, text) -> {
if (text == null || text.isEmpty())
throw new IllegalArgumentException("Text cannot be null or empty!");
return Result.COMPLETED;
})
.exceptionally(exception -> Result.FAILED);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment