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

Unified Diff: sdk/lib/collection/hash_set.dart

Issue 18837002: Move toString() to collection classes. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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
Index: sdk/lib/collection/hash_set.dart
diff --git a/sdk/lib/collection/hash_set.dart b/sdk/lib/collection/hash_set.dart
index 86c69c81ee5f4346fea08f0b42fbfc8bec58300f..c30f1bffdada1bf9882a96e5513bf2bdd4202f00 100644
--- a/sdk/lib/collection/hash_set.dart
+++ b/sdk/lib/collection/hash_set.dart
@@ -6,6 +6,8 @@ part of dart.collection;
/** Common parts of [HashSet] and [LinkedHashSet] implementations. */
abstract class _HashSetBase<E> extends IterableBase<E> implements Set<E> {
+ static List _toStringList = new List();
+
// Set.
bool containsAll(Iterable<Object> other) {
for (Object object in other) {
@@ -53,7 +55,17 @@ abstract class _HashSetBase<E> extends IterableBase<E> implements Set<E> {
retainWhere(retainSet.contains);
}
- String toString() => ToString.iterableToString(this);
+ String toString() {
+ for(int i = 0; i < _toStringList.length; i++) {
+ if(identical(_toStringList[i], this))
+ return '{...}';
+ }
+ _toStringList.add(this);
+ String result = IterableMixinWorkaround.toStringIterable(this);
+ _toStringList.remove(this);
floitsch 2013/07/08 12:00:50 Same comments as before.
zarah 2013/07/08 14:35:15 Done.
+ print(result);
floitsch 2013/07/08 12:00:50 Remove debug print.
zarah 2013/07/08 14:35:15 Done.
+ return result;
+ }
}
/**

Powered by Google App Engine
This is Rietveld 408576698