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

Side by Side Diff: sdk/lib/collection/maps.dart

Issue 12016014: Undo bad change in Maps class. Fix test. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | tests/corelib/maps_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of dart.collection; 5 part of dart.collection;
6 6
7 /* 7 /*
8 * Helper class which implements complex [Map] operations 8 * Helper class which implements complex [Map] operations
9 * in term of basic ones ([Map.keys], [Map.operator []], 9 * in term of basic ones ([Map.keys], [Map.operator []],
10 * [Map.operator []=] and [Map.remove].) Not all methods are 10 * [Map.operator []=] and [Map.remove].) Not all methods are
(...skipping 27 matching lines...) Expand all
38 return v; 38 return v;
39 } 39 }
40 40
41 static clear(Map map) { 41 static clear(Map map) {
42 for (final k in map.keys.toList()) { 42 for (final k in map.keys.toList()) {
43 map.remove(k); 43 map.remove(k);
44 } 44 }
45 } 45 }
46 46
47 static forEach(Map map, void f(key, value)) { 47 static forEach(Map map, void f(key, value)) {
48 map.keys.forEach(f); 48 for (final k in map.keys) {
49 f(k, map[k]);
50 }
49 } 51 }
50 52
51 static Iterable getValues(Map map) { 53 static Iterable getValues(Map map) {
52 return map.keys.mappedBy((key) => map[key]); 54 return map.keys.mappedBy((key) => map[key]);
53 } 55 }
54 56
55 static int length(Map map) => map.keys.length; 57 static int length(Map map) => map.keys.length;
56 58
57 static bool isEmpty(Map map) => map.keys.isEmpty; 59 static bool isEmpty(Map map) => map.keys.isEmpty;
58 60
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 first = false; 102 first = false;
101 Collections._emitObject(k, result, visiting); 103 Collections._emitObject(k, result, visiting);
102 result.add(': '); 104 result.add(': ');
103 Collections._emitObject(v, result, visiting); 105 Collections._emitObject(v, result, visiting);
104 }); 106 });
105 107
106 result.add('}'); 108 result.add('}');
107 visiting.removeLast(); 109 visiting.removeLast();
108 } 110 }
109 } 111 }
OLDNEW
« no previous file with comments | « no previous file | tests/corelib/maps_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698