Created
December 15, 2019 03:25
-
-
Save benweidig/0d7aaeabfe2074524ad247de4af5bc9c to your computer and use it in GitHub Desktop.
This file contains 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
// Case 1: We know there's a value | |
Optional<String> withValue = Optional.of("definitly a string"); | |
// Case 2: We 're not sure | |
Optional<String> maybeValue = Optional.ofNullable(null); | |
// Case 3: We're sure there's no value | |
Optional<String> noValue = Optional.empty(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment