Code example for Ordering

Methods: compare

0
    } 
 
    @SuppressWarnings({"unchecked"}) 
    @Override 
    public int compareTo(LexicographicPair<A, B> other) {
        int result = ordering.compare(getLeft(), other.getLeft());
        if (result == 0) {
            return ordering.compare(getRight(), other.getRight());
        } else { 
            return result;
        } 
    } 
 
    public static <A extends Comparable<A>, B extends Comparable<B>> LexicographicPair<A, B> pair(A left, B right) {
        return new LexicographicPair<A, B>(left, right);
    } 
}