Chromium Code Reviews| Index: lib/src/utils.dart |
| diff --git a/lib/src/utils.dart b/lib/src/utils.dart |
| index 3b8111d0f379e9a1171f397c54c42e0984c937e8..f236814aa7a902cfe79a74a67f269a4c4d81cf72 100644 |
| --- a/lib/src/utils.dart |
| +++ b/lib/src/utils.dart |
| @@ -51,6 +51,23 @@ final OperatingSystem currentOSGuess = (() { |
| return OperatingSystem.linux; |
| })(); |
| +/// A pair of values. |
| +class Pair<E, F> { |
| + E first; |
|
kevmoo
2015/04/21 03:48:38
both could be final?
nweiz
2015/04/21 20:01:04
I'd rather keep this identical to the implementati
|
| + F last; |
| + |
| + Pair(this.first, this.last); |
| + |
| + String toString() => '($first, $last)'; |
| + |
| + bool operator==(other) { |
|
kevmoo
2015/04/21 03:48:38
I'm a big fan of other is Pair && other.first == f
|
| + if (other is! Pair) return false; |
| + return other.first == first && other.last == last; |
| + } |
| + |
| + int get hashCode => first.hashCode ^ last.hashCode; |
| +} |
| + |
| /// Get a string description of an exception. |
| /// |
| /// Many exceptions include the exception class name at the beginning of their |