Skip to content

Instantly share code, notes, and snippets.

@afcastano
Created July 7, 2016 13:00
Show Gist options
  • Save afcastano/759ba1222e65cbd36d7c69754e8ad5fc to your computer and use it in GitHub Desktop.
Save afcastano/759ba1222e65cbd36d7c69754e8ad5fc to your computer and use it in GitHub Desktop.
flatMap method on the result monad.
public<U> Result<U> flatMap(Function<? super S, Result<U>> mapper) {
if (error.isPresent()) {
return fail(error.get());
}
return mapper.apply(value.get());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment