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

Unified Diff: runtime/lib/collection_patch.dart

Issue 26280002: Set.add returns true if item has been added, otherwise false (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: docs Created 7 years, 2 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
« no previous file with comments | « no previous file | sdk/lib/_internal/lib/collection_patch.dart » ('j') | sdk/lib/core/set.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/collection_patch.dart
diff --git a/runtime/lib/collection_patch.dart b/runtime/lib/collection_patch.dart
index 9f0c74fad4a7efd0bc94e22c91b32e61cbf21786..f5a906ec146a040787627d443c46f1a1185e7779 100644
--- a/runtime/lib/collection_patch.dart
+++ b/runtime/lib/collection_patch.dart
@@ -571,15 +571,16 @@ class _HashSet<E> extends _HashSetBase<E> implements HashSet<E> {
// Set.
- void add(E element) {
+ bool add(E element) {
int hashCode = _hashCode(element);
int index = hashCode & (_buckets.length - 1);
HashSetEntry entry = _buckets[index];
while (entry != null) {
- if (_equals(entry.key, element)) return;
+ if (_equals(entry.key, element)) return false;
entry = entry.next;
}
_addEntry(element, hashCode, index);
+ return true;
}
void addAll(Iterable<E> objects) {
« no previous file with comments | « no previous file | sdk/lib/_internal/lib/collection_patch.dart » ('j') | sdk/lib/core/set.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698