Search posts, tags, users, and pages
Andres Pastorini
Dear Student
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...
Shai Almog
Yak Barber, duck whisperer, hunter of bugs, feeder of dogs, heap climber, stack explorer and rider of shells
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
Yak Barber, duck whisperer, hunter of bugs, feeder of dogs, heap climber, stack explorer and rider of shells
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 .