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

Side by Side Diff: runtime/lib/immutable_map.dart

Issue 10990083: Reapply change to hide VM-only List implementation classes. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix dart:io perf regression. Created 8 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 | « runtime/lib/growable_array.dart ('k') | runtime/lib/literal_factory.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) 2011, 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 // Immutable map class for compiler generated map literals. 4 // Immutable map class for compiler generated map literals.
5 5
6 class ImmutableMap<K, V> implements Map<K, V> { 6 class ImmutableMap<K, V> implements Map<K, V> {
7 final ImmutableArray kvPairs_; 7 final _ImmutableArray kvPairs_;
8 8
9 const ImmutableMap._create(ImmutableArray keyValuePairs) 9 const ImmutableMap._create(_ImmutableArray keyValuePairs)
10 : kvPairs_ = keyValuePairs; 10 : kvPairs_ = keyValuePairs;
11 11
12 12
13 V operator [](K key) { 13 V operator [](K key) {
14 // TODO(hausner): Since the keys are sorted, we could do a binary 14 // TODO(hausner): Since the keys are sorted, we could do a binary
15 // search. But is it worth it? 15 // search. But is it worth it?
16 for (int i = 0; i < kvPairs_.length - 1; i += 2) { 16 for (int i = 0; i < kvPairs_.length - 1; i += 2) {
17 if (key == kvPairs_[i]) { 17 if (key == kvPairs_[i]) {
18 return kvPairs_[i+1]; 18 return kvPairs_[i+1];
19 } 19 }
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 85
86 V remove(K key) { 86 V remove(K key) {
87 throw const IllegalAccessException(); 87 throw const IllegalAccessException();
88 } 88 }
89 89
90 String toString() { 90 String toString() {
91 return Maps.mapToString(this); 91 return Maps.mapToString(this);
92 } 92 }
93 } 93 }
94 94
OLDNEW
« no previous file with comments | « runtime/lib/growable_array.dart ('k') | runtime/lib/literal_factory.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698