public boolean equals()

in sarif/src/main/java/com/jetbrains/qodana/sarif/baseline/ResultKey.java [22:50]


    public boolean equals(Object o) {
        if (result == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        ResultKey key = (ResultKey) o;
        Result oResult = key.result;

        if (!equalsMessage(result.getMessage(), oResult.getMessage()) ||
                !Objects.equals(result.getRuleId(), oResult.getRuleId()) ||
                !Objects.equals(result.getLevel(), oResult.getLevel())
        ) {
            return false;
        }

        List<Location> locations = result.getLocations();
        List<Location> oLocations = oResult.getLocations();
        if (locations == null) return oLocations == null;
        if (oLocations == null) return false;
        if (locations.size() != oLocations.size()) return false;

        Iterator<Location> iterator = locations.iterator();
        Iterator<Location> oIterator = oLocations.iterator();
        while (iterator.hasNext()) {
            Location location = iterator.next();
            Location oLocation = oIterator.next();
            if (!equalsLocation(location, oLocation)) return false;
        }

        return true;
    }