Should I throw a NullPointerException explicitly or let Java do it for me?
问题 As the title says, I am wondering what the best practice is regarding the throwing of NullPointerExceptions. Specifically, if I have an external library function that can return null in circumstances that I don't want to actually handle (see below for a specific example), as the null indicates a problem with the software. The question is, should I check the return value for null and throw the NullPointerException myself, or should I just let Java do the dirty work for me as soon as I try to