All Questions
2 questions
1
vote
2
answers
5k
views
SonarQube is complaining about: "Use isEmpty() to check whether the collection is empty or not."
So as my the title says, SonarQube is complaining whenever you use
list.size() == 0
or
list.size > 0
However I started changing to isEmpty() and !is.Empty() and noticed the code becomes way ...
1
vote
2
answers
4k
views
Using the same name for setter and gettter methods for a boolean member variable
Say I have class with a boolean member variable fancy:
public class MyClass {
private boolean fancy;
}
Case 1. I could the define the setter and getter as follows:
// getter
public boolean ...