Chromium Code Reviews| Index: sdk/lib/io/platform_impl.dart |
| diff --git a/sdk/lib/io/platform_impl.dart b/sdk/lib/io/platform_impl.dart |
| index c6063a8c21265283f710ee427b0d959041586bc7..a7631275628111a73343badb51eaee4039a35317 100644 |
| --- a/sdk/lib/io/platform_impl.dart |
| +++ b/sdk/lib/io/platform_impl.dart |
| @@ -71,7 +71,7 @@ class _Platform { |
| result[str.substring(0, equalsIndex)] = |
| str.substring(equalsIndex + 1); |
| } |
| - _environmentCache = new UnmodifiableMapView(result); |
| + _environmentCache = new UnmodifiableMapView<String, String>(result); |
| } else { |
| _environmentCache = env; |
| } |
| @@ -89,36 +89,20 @@ class _Platform { |
| // Environment variables are case-insensitive on Windows. In order |
| // to reflect that we use a case-insensitive string map on Windows. |
| -class _CaseInsensitiveStringMap<V> implements Map<String, V> { |
| - Map<String, V> _map; |
| +class _CaseInsensitiveStringMap<V> extends MapMixin<String, V> { |
|
Lasse Reichstein Nielsen
2014/06/07 12:49:40
Extend MapBase instead of MapMixin.
It's silly to
|
| + final Map<String, V> _map = new Map<String, V>(); |
| - _CaseInsensitiveStringMap() : _map = new Map<String, V>(); |
| - |
| - _CaseInsensitiveStringMap.from(Map<String, V> other) |
| - : _map = new Map<String, V>() { |
| - other.forEach((String key, V value) { |
| - _map[key.toUpperCase()] = value; |
| - }); |
| - } |
| - |
| - bool containsKey(String key) => _map.containsKey(key.toUpperCase()); |
| - bool containsValue(Object value) => _map.containsValue(value); |
| V operator [](String key) => _map[key.toUpperCase()]; |
| + |
| void operator []=(String key, V value) { |
| _map[key.toUpperCase()] = value; |
| } |
| - V putIfAbsent(String key, V ifAbsent()) { |
| - _map.putIfAbsent(key.toUpperCase(), ifAbsent); |
| - } |
| - addAll(Map other) { |
| - other.forEach((key, value) => this[key.toUpperCase()] = value); |
| - } |
| + |
| V remove(String key) => _map.remove(key.toUpperCase()); |
|
Lasse Reichstein Nielsen
2014/06/07 12:49:41
Remove should take an Object as argument, and just
|
| + |
| void clear() => _map.clear(); |
| - void forEach(void f(String key, V value)) => _map.forEach(f); |
| + |
| Iterable<String> get keys => _map.keys; |
| - Iterable<V> get values => _map.values; |
| - int get length => _map.length; |
| - bool get isEmpty => _map.isEmpty; |
| - bool get isNotEmpty => _map.isNotEmpty; |
| + |
| + String toString() => _map.toString(); |
| } |
|
Lasse Reichstein Nielsen
2014/06/09 09:55:20
If all of this is to just have a better toString,
|