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

Unified Diff: lib/pb_list.dart

Issue 64753003: Update hashCode to hash the entire message (Closed) Base URL: https://github.com/dart-lang/dart-protobuf.git@master
Patch Set: Update version number Created 7 years, 1 month 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
« no previous file with comments | « lib/generated_message.dart ('k') | lib/unknown_field_set.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/pb_list.dart
diff --git a/lib/pb_list.dart b/lib/pb_list.dart
index 9b23e48c0d09742b286876c15494b218ae02ef62..943a16c0cb7da17b71197cb1db47798904c53dfd 100644
--- a/lib/pb_list.dart
+++ b/lib/pb_list.dart
@@ -13,7 +13,18 @@ class PbList<E> extends Object with ListMixin<E> implements List<E> {
bool operator ==(other) =>
(other is PbList) && _areListsEqual(other, this);
- int get hashCode => _wrappedList.hashCode;
+ int get hashCode {
+ int hash = 0;
+ _wrappedList.forEach((value) {
+ hash = (hash + value.hashCode) & 0x3fffffff;
+ hash = (hash + hash << 10) & 0x3fffffff;
+ hash = (hash ^ hash >> 6) & 0x3fffffff;
+ });
+ hash = (hash + hash << 3) & 0x3fffffff;
+ hash = (hash ^ hash >> 11) & 0x3fffffff;
+ hash = (hash + hash << 15) & 0x3fffffff;
+ return hash;
+ }
/**
* Returns an [Iterator] for the list.
« no previous file with comments | « lib/generated_message.dart ('k') | lib/unknown_field_set.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698