The agreement is to ask a question in the title.
isEmpty() hasChildren()
Thus, the names are read as if they will have a question mark at the end.
Is the collection empty?
Does this Node have kids?
And then true means yes, and false means no.
Or you can read this as a statement:
The collection is empty.
Node has children
Note:
Sometimes you may need to name a method similar to createFreshSnapshot? . Without a question mark, the name implies that the method should create a snapshot, not check if it is required.
In this case, you must rethink what you are actually asking. Something like isSnapshotExpired is a much better name and conveys what the method will tell you when it is called.
If you use Google Search for isEmpty() in the Java API, you get a lot of results.
jjnguy Oct 06 '10 at 15:50 2010-10-06 15:50
source share