Created
March 22, 2017 07:08
-
-
Save RealDeanZhao/cb3cf3655a3b21b13136635d94335ed3 to your computer and use it in GitHub Desktop.
Deal with Optional using lambda
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if (...) { | |
| return redirectToAuthCodeUrl(); | |
| } else { | |
| return Response.ok().build(); | |
| } | |
| --> | |
| return sessionToken | |
| .filter(it -> ...) | |
| .map(it -> Response.ok().build()) | |
| .orElse(redirectToAuthCodeUrl()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment