ComparableMixin class
class ComparableMixin implements Comparable {
bool operator ==(other) => compareTo(other) == 0;
bool operator <(other) => compareTo(other) == -1;
bool operator <=(other) => compareTo(other) <= 0;
bool operator >(other) => compareTo(other) == 1;
bool operator >=(other) => compareTo(other) > 0;
}
Implements
Operators
bool operator ==(other) #
The equality operator.
The default behavior for all Objects is to return true if and
only if this and
other are the same object.
If a subclass overrides the equality operator it should override
the hashCode method as well to maintain consistency.
docs inherited from Object
bool operator ==(other) => compareTo(other) == 0;
Methods
abstract int compareTo(T other) #
inherited from Comparable
Compares this object to another Comparable
Returns a value like a Comparator when comparing this to
other.
May throw an ArgumentError if
other is of a type that
is not comparable to this.