So code reviewers are complaining about code like this:
boolean myFlag = false;
They are saying it should be:
boolean myFlag = Boolean.FALSE;
Is this just some fetish with not using keywords or is there a valid reason to do this?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
No, that’s completely pointless. It would make sense to use:
to avoid the call to
Boolean.valueOf(autoboxing) but in your code there is no boxing, and their suggestion introduces an unnecessary unboxing operation.As ever though, if someone suggests something and you don’t understand why, your first port of call should be asking them.