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

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

Issue 18282008: Revert "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
« no previous file with comments | « sdk/lib/collection/list.dart ('k') | sdk/lib/collection/queue.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/collection/maps.dart
diff --git a/sdk/lib/collection/maps.dart b/sdk/lib/collection/maps.dart
index 9bc7a54ede772f7d359e8448be0a5c017dfe803d..303008cc6950a815089473c7b0f4e181b89cda13 100644
--- a/sdk/lib/collection/maps.dart
+++ b/sdk/lib/collection/maps.dart
@@ -60,9 +60,6 @@ class Maps {
static bool isNotEmpty(Map map) => map.keys.isNotEmpty;
- // A list to identify cyclic maps during toString() calls.
- static List _toStringList = new List();
-
/**
* Returns a string representing the specified map. The returned string
* looks like this: [:'{key0: value0, key1: value1, ... keyN: valueN}':].
@@ -79,33 +76,7 @@ class Maps {
* A typical implementation of a map's [toString] method will
* simply return the results of this method applied to the collection.
*/
- static String mapToString(Map m) {
- for (int i = 0; i < _toStringList.length; i++) {
- if (identical(_toStringList[i], m)) { return '{...}'; }
- }
-
- var result = new StringBuffer();
- try {
- _toStringList.add(m);
- result.write('{');
- bool first = true;
- m.forEach((k, v) {
- if(!first) {
- result.write(', ');
- }
- first = false;
- result.write(k);
- result.write(': ');
- result.write(v);
- });
- result.write('}');
- } finally {
- assert(identical(_toStringList.last, m));
- _toStringList.removeLast();
- }
-
- return result.toString();
- }
+ static String mapToString(Map m) => ToString.mapToString(m);
static _id(x) => x;
« no previous file with comments | « sdk/lib/collection/list.dart ('k') | sdk/lib/collection/queue.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698