While solving sonarQube issue i face the below warning,does any one tell me how to overcome this warning
Method:-
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Division other = (Division) obj;
if (divisionId != other.divisionId)
//getting warning for above if condition
return false;
return true;
}
Warning :
Replace this if-then-else statement by a single return statement.
Description:-
Return of boolean literal statements wrapped into if-then-else ones should be simplified.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…