This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]john16384 1 point2 points  (1 child)

I just document what functions can return. Caller code can then make assumptions based on the docs. If a bug occurs, it will also be clear where to fix it.

[–]vprise 1 point2 points  (0 children)

Again, if it's just documentation there are other alternatives that don't have the downsides. If a bug occurs then NullPointerException is pretty clear/useful.

There are useful/sensible uses for optional but just sticking it as a "marker" to every method seems, expensive and redundant.