OLD | NEW |
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 _js_helper; | 5 part of _js_helper; |
6 | 6 |
7 class ConstantMapView<K, V> extends UnmodifiableMapView | 7 class ConstantMapView<K, V> extends UnmodifiableMapView |
8 implements ConstantMap { | 8 implements ConstantMap { |
9 ConstantMapView(Map base) : super(base); | 9 ConstantMapView(Map base) : super(base); |
10 } | 10 } |
11 | 11 |
12 abstract class ConstantMap<K, V> implements Map<K, V> { | 12 abstract class ConstantMap<K, V> implements Map<K, V> { |
13 // Used to create unmodifiable maps from other maps. | 13 // Used to create unmodifiable maps from other maps. |
14 factory ConstantMap.from(Map other) { | 14 factory ConstantMap.from(Map other) { |
15 List keys = other.keys.toList(); | 15 List keys = other.keys.toList(); |
16 bool allStrings = true; | 16 bool allStrings = true; |
17 for (var k in keys) { | 17 for (var k in keys) { |
18 if (k is! String) { | 18 if (k is! String) { |
19 allStrings = false; | 19 allStrings = false; |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 Iterable<K> get keys { | 179 Iterable<K> get keys { |
180 return _getMap().keys; | 180 return _getMap().keys; |
181 } | 181 } |
182 | 182 |
183 Iterable<V> get values { | 183 Iterable<V> get values { |
184 return _getMap().values; | 184 return _getMap().values; |
185 } | 185 } |
186 | 186 |
187 int get length => _getMap().length; | 187 int get length => _getMap().length; |
188 } | 188 } |
OLD | NEW |