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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/util/expensive_set.dart

Issue 26662006: Changed LinkedHashSet to Set and LinkedHashMap to Map. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: HashMap -> Map. 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/util/expensive_map.dart ('k') | no next file » | 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 dart2js.util; 5 part of dart2js.util;
6 6
7 /** 7 /**
8 * The expensive set is a data structure useful for tracking down 8 * The expensive set is a data structure useful for tracking down
9 * excessive memory usage due to large sets. It acts as an ordinary 9 * excessive memory usage due to large sets. It acts as an ordinary
10 * hash set, but it uses 10 times more memory (by default). 10 * hash set, but it uses 10 times more memory (by default).
11 */ 11 */
12 class ExpensiveSet<E> extends IterableBase<E> implements LinkedHashSet<E> { 12 class ExpensiveSet<E> extends IterableBase<E> implements Set<E> {
13 13
14 final List _sets; 14 final List _sets;
15 15
16 ExpensiveSet([int copies = 10]) : _sets = new List(copies) { 16 ExpensiveSet([int copies = 10]) : _sets = new List(copies) {
17 assert(copies > 0); 17 assert(copies > 0);
18 for (int i = 0; i < _sets.length; i++) { 18 for (int i = 0; i < _sets.length; i++) {
19 _sets[i] = new LinkedHashSet<E>(); 19 _sets[i] = new Set<E>();
20 } 20 }
21 } 21 }
22 22
23 int get length => _sets[0].length; 23 int get length => _sets[0].length;
24 bool get isEmpty => _sets[0].isEmpty; 24 bool get isEmpty => _sets[0].isEmpty;
25 bool get isNotEmpty => _sets[0].isNotEmpty; 25 bool get isNotEmpty => _sets[0].isNotEmpty;
26 26
27 Iterator<E> get iterator => _sets[0].iterator; 27 Iterator<E> get iterator => _sets[0].iterator;
28 28
29 bool contains(Object object) => _sets[0].contains(object); 29 bool contains(Object object) => _sets[0].contains(object);
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 if (objectsToRetain is Set) { 113 if (objectsToRetain is Set) {
114 retainSet = objectsToRetain; 114 retainSet = objectsToRetain;
115 } else { 115 } else {
116 retainSet = objectsToRetain.toSet(); 116 retainSet = objectsToRetain.toSet();
117 } 117 }
118 retainWhere(retainSet.contains); 118 retainWhere(retainSet.contains);
119 } 119 }
120 120
121 String toString() => "expensive(${_sets[0]}x${_sets.length})"; 121 String toString() => "expensive(${_sets[0]}x${_sets.length})";
122 } 122 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/util/expensive_map.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698