/** * Implements a Comparable interface method to compare based on diffId * property. */ @Override public int compareTo(NodeDiff o) { return diffId - o.getDiffId(); } }
/** * Implements a Comparable interface method to compare based on diffId property. */ public int compareTo(Object o) { if (!(o instanceof NodeDiff)) { throw new IllegalArgumentException("Can't compare to " + o); } return diffId - ((NodeDiff) o).getDiffId(); } }