Created
September 26, 2018 01:39
-
-
Save edwingustafson/f3c9150ac2b15edc4542101534b84c3b to your computer and use it in GitHub Desktop.
Monad-style Hello, World!
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
import java.util.*; | |
/** | |
* Hello, world! program using Optional monad | |
*/ | |
public class HelloWorld { | |
public static void main(final String[] args) { | |
Optional.of("Hello, world!").ifPresent(System.out::println); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment