Es sollte eine Regel geben, die auftretende Muster für Vereinfachungen identifiziert. In der folgenden Implementierung sollte zum Beispiel equals statt compareTo verwendet werden.
public boolean isStartDate(LocalDate date) {
if (this.startDate.compareTo(date) == 0) {
return true;
} else {
return false;
}
}
The rule Simplify implements this pattern. Currently the code is commented out because the approach is too simple and caused problems in contexts where the use of compareTo and 0 is reasonable.
Es sollte eine Regel geben, die auftretende Muster für Vereinfachungen identifiziert. In der folgenden Implementierung sollte zum Beispiel
equals
stattcompareTo
verwendet werden.