Dart DocumentationutilsPair<E, F>

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

new Pair(E first, F last) #

Creates a new Object instance.

Object instances have no meaningful state, and are only useful through their identity. An Object instance is equal to itself only.

docs inherited from Object
Pair(this.first, this.last);

Properties

E first #

E first

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;

F last #

F last

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;
}

Methods

String toString() #

Returns a string representation of this object.

docs inherited from Object
String toString() => '($first, $last)';