ComparablePair<T1 extends Comparable, T2 extends Comparable> extension

Adds C++ <utility> relational operators securely without sacrificing generic safety. These operators (<, <=, >, >=, compareTo) automatically unlock when both T1 and T2 happen to extend Comparable.

on

Methods

compareTo(Pair<T1, T2> other) int

Available on Pair<T1, T2>, provided by the ComparablePair extension

Compares this pair lexicographically with other.

Operators

operator <(Pair<T1, T2> other) bool

Available on Pair<T1, T2>, provided by the ComparablePair extension

Returns whether this pair is lexicographically less than other.
operator <=(Pair<T1, T2> other) bool

Available on Pair<T1, T2>, provided by the ComparablePair extension

Returns whether this pair is lexicographically less than or equal to other.
operator >(Pair<T1, T2> other) bool

Available on Pair<T1, T2>, provided by the ComparablePair extension

Returns whether this pair is lexicographically greater than other.
operator >=(Pair<T1, T2> other) bool

Available on Pair<T1, T2>, provided by the ComparablePair extension

Returns whether this pair is lexicographically greater than or equal to other.