Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(290)

Unified Diff: pkg/collection/lib/src/utils.dart

Issue 350183010: Add a CanonicalizedMap class to pkg/collection. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: code review Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/collection/lib/src/utils.dart
diff --git a/pkg/collection/lib/src/utils.dart b/pkg/collection/lib/src/utils.dart
new file mode 100644
index 0000000000000000000000000000000000000000..cc413fc6c6da417e1bb48d0be48a1e66e66e3f4f
--- /dev/null
+++ b/pkg/collection/lib/src/utils.dart
@@ -0,0 +1,22 @@
+// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library dart.pkg.collection.utils;
+
+/// 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;
Lasse Reichstein Nielsen 2014/07/01 09:18:15 I'd prefer some less symmetric operation, like =
nweiz 2014/07/01 21:21:44 Removed these.
+}

Powered by Google App Engine
This is Rietveld 408576698