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

Side by Side Diff: lib/immutable_map.dart

Issue 8348025: - Remove the remaining Array interface. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 9 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 | « lib/growable_array.dart ('k') | vm/object.cc » ('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(ImmutableArray keyValuePairs) 9 const ImmutableMap(ImmutableArray keyValuePairs)
10 : kvPairs_ = keyValuePairs; 10 : kvPairs_ = keyValuePairs;
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 String toString() { 90 String toString() {
91 // TODO(srdjan): Extend text representation. 91 // TODO(srdjan): Extend text representation.
92 return "ImmutableMap"; 92 return "ImmutableMap";
93 } 93 }
94 } 94 }
95 95
96 96
97 class MutableMap { 97 class MutableMap {
98 // [elements] contains n key-value pairs. The keys are at position 98 // [elements] contains n key-value pairs. The keys are at position
99 // 2*n, the values at position 2*n+1. 99 // 2*n, the values at position 2*n+1.
100 static fromLiteral(Array elements) { 100 static fromLiteral(List elements) {
101 var map = new LinkedHashMap(); 101 var map = new LinkedHashMap();
102 var len = elements.length; 102 var len = elements.length;
103 for (int i = 1; i < len; i += 2) { 103 for (int i = 1; i < len; i += 2) {
104 map[elements[i-1]] = elements[i]; 104 map[elements[i-1]] = elements[i];
105 } 105 }
106 return map; 106 return map;
107 } 107 }
108 } 108 }
OLDNEW
« no previous file with comments | « lib/growable_array.dart ('k') | vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698