Void is also a dummy class.
Void also refers generically to the various flavours of hollow Strings, namely: blank (i.e x.length() != 0 && x.trim().length() == 0, e.g. ), empty (i.e. x.length() == 0, e.g. "") and null (i.e. x == null). One of the most common sources of error in Java programs comes from confusing the three different flavours of void strings. Java code often has a maintenance timebomb ticking in it in the form of inconsistent representation of void strings and objects. It is unwise to just let NullPointerException find your problems for you. The problem may surface many kilometers from the true source of the problem. There will always be one more bug. It is better to decide on your canonical void representation and be fanatically rigid about it.
Which void representation should you use?
There are two plausible canonical representations for void namely null and empty (""). Normally you combine either of them with canthappen. The four ways you might represent void Strings are:
In a similar way you can get into trouble returning null instead of an empty Collection. One convention, used by File.list, is to return an empty array or Collection for no elements, and null to represent the result of an invalid request.
// making IntelliJ @NotNull and @Nullable available to your program import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable;The IntelliJ annotations.jar file must be available to javac.exe on the processorpath (usually the classpath) for them to work. You must specify the specific jar, not just the directory.
available on the web at:
optional Replicator mirror
Please email your feedback for publication, letters to the editor, errors, omissions, typos, formatting errors, ambiguities, unclear wording, broken/redirected link reports, suggestions to improve this page or comments to Roedy Green : . If you want your message, your name or email kept confidential, not considered for public posting, please explicitly specify that. Unless you state otherwise, I will treat your message as a letter to the editor that I may or may not publish in the feedback section. After that, it will be too late to retract it. If you disagree with something I said, especially when sending an ad-hominem attack, a rant composed mainly of obscenities or a death threat, please quote the offending passage and cite the web page where you found it, tell me why you think it is wrong, and, if possible, provide some supporting evidence. I can’t very well fix erroneous or ambiguous text if I can’t find it.
Your face IP:[188.8.131.52]
|Feedback||You are visitor number 82,404.|