Passionate developer in Java and Scala. And sometimes, something else. A few months per year, someone calls me "professor". CoFounder of Scala By The Lagoon @scalagoon
The most important part is that using the Optional you are explicilty telling the user of your API that they may receive a value, or they may not. And both cases are clearly usable and testable.
That's basically the only use I see for using Optional, clear communication that you might not get anything.
Because for the rest it is just as unsafe.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
The most important part is that using the
Optional
you are explicilty telling the user of your API that they may receive a value, or they may not. And both cases are clearly usable and testable.That's basically the only use I see for using Optional, clear communication that you might not get anything.
Because for the rest it is just as unsafe.