Yannick Majoros commented on the post, In Defence of Java 8’s Optional: Why and How to Use It 4 years, 3 months ago
The difference between a method returning null for elements that aren’t found, or Optional.empty() for the same, is that you just can’t forget the check. You will need it if you want your code to even compile, as stated in “Types to the rescue” in TFA.
Some other example…
Optional ownerOptional = find(“Roger”);
Person owner =…[Read more]