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

Unified Diff: corelib/src/implementation/hash_map_set.dart

Issue 10836009: Change Set.add to return a boolean indicating success. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 5 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 | corelib/src/set.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: corelib/src/implementation/hash_map_set.dart
diff --git a/corelib/src/implementation/hash_map_set.dart b/corelib/src/implementation/hash_map_set.dart
index c538951fff31beb62674103b8c7517339c0c8ded..8dc54a9f64e8bafe588c1f62d74f9dda8e67ed51 100644
--- a/corelib/src/implementation/hash_map_set.dart
+++ b/corelib/src/implementation/hash_map_set.dart
@@ -292,8 +292,10 @@ class HashSetImplementation<E extends Hashable> implements HashSet<E> {
_backingMap.clear();
}
- void add(E value) {
+ bool add(E value) {
+ if (_backingMap.containsKey(value)) return false;
_backingMap[value] = value;
+ return true;
}
bool contains(E value) {
« no previous file with comments | « no previous file | corelib/src/set.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698