When naming a boolean, or a function returning a boolean it's usual to prefix with 'is' e.g.
What about when refering to multiple items, should it be:
I can see arguments for both; is offers consistency and perhaps slightly better readability, are makes the code read in a more natural way.
Any opinions?
[Mandatory] Do not add 'is' as prefix while defining Boolean variable, since it may cause a serialization exception in some Java frameworks.
Boolean values are values that evaluate to either true or false , and are represented by the boolean data type. Boolean expressions are very similar to mathematical expressions, but instead of using mathematical operators such as "+" or "-", you use comparative or boolean operators such as "==" or "!".
Boolean variables should be prefixed with 'is' This is the naming convention for boolean methods and variables used by Sun for the Java core packages. Using the is prefix solves a common problem of choosing bad boolean names like status or flag.
Boolean variables can either be True or False and are stored as 16-bit (2-byte) values. Boolean variables are displayed as either True or False. Like C, when other numeric data types are converted to Boolean values then a 0 becomes False and any other values become True.
Firstly, isPointersNull
is just ugly. Don't do that.
I typically go with any
or all
, as are
can be ambiguous. Does it mean "there are null pointers" or "the pointers are all null"? anyPointersNull
and allPointersNull
clear that up, IMO.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With