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

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

Issue 9692068: Fixed some static type warnings in vm core libraries (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merged up Created 8 years, 9 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/date.dart ('k') | runtime/lib/regexp.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) 2011, 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;
(...skipping 28 matching lines...) Expand all
39 int numKeys = length; 39 int numKeys = length;
40 List<K> list = new List<K>(numKeys); 40 List<K> list = new List<K>(numKeys);
41 for (int i = 0; i < numKeys; i++) { 41 for (int i = 0; i < numKeys; i++) {
42 list[i] = kvPairs_[i*2]; 42 list[i] = kvPairs_[i*2];
43 } 43 }
44 return list; 44 return list;
45 } 45 }
46 46
47 Collection<V> getValues() { 47 Collection<V> getValues() {
48 int numValues = length; 48 int numValues = length;
49 List<K> list = new List<K>(numValues); 49 List<V> list = new List<V>(numValues);
50 for (int i = 0; i < numValues; i++) { 50 for (int i = 0; i < numValues; i++) {
51 list[i] = kvPairs_[i*2 + 1]; 51 list[i] = kvPairs_[i*2 + 1];
52 } 52 }
53 return list; 53 return list;
54 } 54 }
55 55
56 bool containsKey(K key) { 56 bool containsKey(K key) {
57 for (int i = 0; i < kvPairs_.length; i += 2) { 57 for (int i = 0; i < kvPairs_.length; i += 2) {
58 if (key == kvPairs_[i]) { 58 if (key == kvPairs_[i]) {
59 return true; 59 return true;
(...skipping 25 matching lines...) Expand all
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/date.dart ('k') | runtime/lib/regexp.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698