public int compareTo()

in src/main/java/org/apache/sling/tooling/lc/jira/Issue.java [59:83]


    public int compareTo(Issue o) {

        Matcher ourMatcher = KEY_PATTERN.matcher(key);
        Matcher theirMatcher = KEY_PATTERN.matcher(o.key);

        if (!ourMatcher.matches()) {
            throw new IllegalArgumentException("No match found for " + key);
        }

        if (!theirMatcher.matches()) {
            throw new IllegalArgumentException("No match found for " + o.key);
        }

        String ourProject = ourMatcher.group(1);
        String theirProject = theirMatcher.group(1);

        if (!Objects.equals(ourProject, theirProject)) {
            return ourProject.compareTo(theirProject);
        }

        int ourId = Integer.parseInt(ourMatcher.group(2));
        int theirId = Integer.parseInt(theirMatcher.group(2));

        return Integer.valueOf(ourId).compareTo(theirId);
    }