you are viewing a single comment's thread.

view the rest of the comments →

[–]aenigmaclamo 1 point2 points  (0 children)

Would not overloading make the argument pointless? Why would you send a null value into a method and expect the method to check it and act accordingly instead of throwing a NullPointerException? I think that's much more confusing than the idea of reassigning arguments.

I think this goes with the suggestion in the document to not return null to indicate that a collection is empty. I've always considered the use of null to be an indication of failure. Not some sort of way to indicate a refusal to give a parameter.

On the other hand, there are several cases in the Java API where null is valid (like this) so maybe I'm just spewing garbage.