'How can i split a overridden method into two in java

I'm working on a project and the maintainer suggested me to split a method into two because checks dose not allow to exceed a certain cyclomatic complexity.

@Override
public boolean equals(Object other) {
    if (this == other) {
        return true;
    }
    if (other == null || getClass() != other.getClass()) {
        return false;
    }
    final Suppression suppression = (Suppression) other;
    return Objects.equals(lineNo, suppression.lineNo)
            && Objects.equals(columnNo, suppression.columnNo)
            && Objects.equals(suppressionType, suppression.suppressionType)
            && Objects.equals(text, suppression.text)
            && Objects.equals(eventSourceRegexp, suppression.eventSourceRegexp)
            && Objects.equals(eventMessageRegexp, suppression.eventMessageRegexp)
            && Objects.equals(eventIdRegexp, suppression.eventIdRegexp)
            && Objects.equals(firstLine, suppression.firstLine)
            && Objects.equals(lastLine, suppression.lastLine);
}

this is the overridden equals method and it is exceeding the maximum cyclomatic complexity limit because of the return statements ig.

He suggested splitting it into two, how can I do that.

I'm a beginner so I don't know about java that much, so if this question is completely invalid, then please tell me😅



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source