Search posts, tags, users, and pages
It is good programming practice, avoid null checking of a value, instead of using if (someObject! = Null), you can use Optional, it can be used as follows: Optional oR = Optional.of (Optional.ofNullable (yourOriginalInstanceToUse) .orElse (YourInsta...
Andres Pastorini
@apastorini · Montevideo
Dear Student
Markdown supported · ⌘↵ to post
Shai Almog
That's an option ;-)
Notice that optional isn't "free" and carries an overhead on top of null .
It's not a big deal but personally I like null .
Shai, You are right, it is true what you say, and thanks for share it.
I think if the performance is not important, Optional could be a good way, helping to reduce the size of the code and a interesting design pattern to improve the maintainability.
Shai Almog
That's an option ;-)
Notice that optional isn't "free" and carries an overhead on top of null .
It's not a big deal but personally I like null .