Pair<E, F> class
A pair of values.
class Pair<E, F> { E first; F last; Pair(this.first, this.last); String toString() => '($first, $last)'; bool operator==(other) { if (other is! Pair) return false; return other.first == first && other.last == last; } int get hashCode => first.hashCode ^ last.hashCode; }
Constructors
Properties
final int hashCode #
Get a hash code for this object.
All objects have hash codes. Hash codes are guaranteed to be the
same for objects that are equal when compared using the equality
operator ==
. Other than that there are no guarantees about
the hash codes. They will not be consistent between runs and
there are no distribution guarantees.
If a subclass overrides hashCode it should override the equality operator as well to maintain consistency.
docs inherited from Object
int get hashCode => first.hashCode ^ last.hashCode;
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) { if (other is! Pair) return false; return other.first == first && other.last == last; }