Skip to content

Instantly share code, notes, and snippets.

@Dalamar42
Created September 7, 2016 10:08
Show Gist options
  • Save Dalamar42/ae89f8bfebc82273a2e984de6b96a75d to your computer and use it in GitHub Desktop.
Save Dalamar42/ae89f8bfebc82273a2e984de6b96a75d to your computer and use it in GitHub Desktop.
String output = "value";
ListenableFuture<String> future = Futures.immediateFuture(output);
Optional<String> transformedOutput = Promise.wrap(future)
.then(value -> value + "_a")
.then(value -> value + "_b")
.get(exception -> log.error(exception.getMessage()));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment