OLD | NEW |
1 part of dart.collection; | 1 part of dart.collection; |
2 abstract class MapBase<K, V> = Object with MapMixin<K, V>; | 2 abstract class MapBase<K, V> = Object with MapMixin<K, V>; |
3 abstract class MapMixin<K, V> implements Map<K, V> {Iterable<K> get keys; | 3 abstract class MapMixin<K, V> implements Map<K, V> {Iterable<K> get keys; |
4 V operator [](Object key); | 4 V operator [](Object key); |
5 operator []=(K key, V value); | 5 operator []=(K key, V value); |
6 V remove(Object key); | 6 V remove(Object key); |
7 void clear(); | 7 void clear(); |
8 void forEach(void action(K key, V value)) { | 8 void forEach(void action(K key, V value)) { |
9 for (K key in keys) { | 9 for (K key in keys) { |
10 action(key, this[key]); | 10 action(key, this[key]); |
(...skipping 22 matching lines...) Expand all Loading... |
33 bool get isNotEmpty => keys.isNotEmpty; | 33 bool get isNotEmpty => keys.isNotEmpty; |
34 Iterable<V> get values => new _MapBaseValueIterable<V>(this); | 34 Iterable<V> get values => new _MapBaseValueIterable<V>(this); |
35 String toString() => Maps.mapToString(this); | 35 String toString() => Maps.mapToString(this); |
36 } | 36 } |
37 abstract class UnmodifiableMapBase<K, V> = MapBase<K, V> with _UnmodifiableMapM
ixin<K, V>; | 37 abstract class UnmodifiableMapBase<K, V> = MapBase<K, V> with _UnmodifiableMapM
ixin<K, V>; |
38 class _MapBaseValueIterable<V> extends IterableBase<V> implements EfficientLeng
th {final Map _map; | 38 class _MapBaseValueIterable<V> extends IterableBase<V> implements EfficientLeng
th {final Map _map; |
39 _MapBaseValueIterable(this._map); | 39 _MapBaseValueIterable(this._map); |
40 int get length => _map.length; | 40 int get length => _map.length; |
41 bool get isEmpty => _map.isEmpty; | 41 bool get isEmpty => _map.isEmpty; |
42 bool get isNotEmpty => _map.isNotEmpty; | 42 bool get isNotEmpty => _map.isNotEmpty; |
43 V get first => ((__x13) => DEVC$RT.cast(__x13, dynamic, V, "CastGeneral", """li
ne 122, column 18 of dart:collection/maps.dart: """, __x13 is V, false))(_map[_m
ap.keys.first]); | 43 V get first => ((__x13) => DEVC$RT.cast(__x13, dynamic, V, "CompositeCast", """
line 122, column 18 of dart:collection/maps.dart: """, __x13 is V, false))(_map[
_map.keys.first]); |
44 V get single => ((__x14) => DEVC$RT.cast(__x14, dynamic, V, "CastGeneral", """l
ine 123, column 19 of dart:collection/maps.dart: """, __x14 is V, false))(_map[_
map.keys.single]); | 44 V get single => ((__x14) => DEVC$RT.cast(__x14, dynamic, V, "CompositeCast", ""
"line 123, column 19 of dart:collection/maps.dart: """, __x14 is V, false))(_map
[_map.keys.single]); |
45 V get last => ((__x15) => DEVC$RT.cast(__x15, dynamic, V, "CastGeneral", """lin
e 124, column 17 of dart:collection/maps.dart: """, __x15 is V, false))(_map[_ma
p.keys.last]); | 45 V get last => ((__x15) => DEVC$RT.cast(__x15, dynamic, V, "CompositeCast", """l
ine 124, column 17 of dart:collection/maps.dart: """, __x15 is V, false))(_map[_
map.keys.last]); |
46 Iterator<V> get iterator => new _MapBaseValueIterator<V>(_map); | 46 Iterator<V> get iterator => new _MapBaseValueIterator<V>(_map); |
47 } | 47 } |
48 class _MapBaseValueIterator<V> implements Iterator<V> {final Iterator _keys; | 48 class _MapBaseValueIterator<V> implements Iterator<V> {final Iterator _keys; |
49 final Map _map; | 49 final Map _map; |
50 V _current = null; | 50 V _current = null; |
51 _MapBaseValueIterator(Map map) : _map = map, _keys = map.keys.iterator; | 51 _MapBaseValueIterator(Map map) : _map = map, _keys = map.keys.iterator; |
52 bool moveNext() { | 52 bool moveNext() { |
53 if (_keys.moveNext()) { | 53 if (_keys.moveNext()) { |
54 _current = ((__x16) => DEVC$RT.cast(__x16, dynamic, V, "CastGeneral", """line 14
4, column 18 of dart:collection/maps.dart: """, __x16 is V, false))(_map[_keys.c
urrent]); | 54 _current = ((__x16) => DEVC$RT.cast(__x16, dynamic, V, "CompositeCast", """line
144, column 18 of dart:collection/maps.dart: """, __x16 is V, false))(_map[_keys
.current]); |
55 return true; | 55 return true; |
56 } | 56 } |
57 _current = null; | 57 _current = null; |
58 return false; | 58 return false; |
59 } | 59 } |
60 V get current => _current; | 60 V get current => _current; |
61 } | 61 } |
62 abstract class _UnmodifiableMapMixin<K, V> implements Map<K, V> {void operator
[]=(K key, V value) { | 62 abstract class _UnmodifiableMapMixin<K, V> implements Map<K, V> {void operator
[]=(K key, V value) { |
63 throw new UnsupportedError("Cannot modify unmodifiable map"); | 63 throw new UnsupportedError("Cannot modify unmodifiable map"); |
64 } | 64 } |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 while (hasNextKey && hasNextValue) { | 184 while (hasNextKey && hasNextValue) { |
185 map[keyIterator.current] = valueIterator.current; | 185 map[keyIterator.current] = valueIterator.current; |
186 hasNextKey = keyIterator.moveNext(); | 186 hasNextKey = keyIterator.moveNext(); |
187 hasNextValue = valueIterator.moveNext(); | 187 hasNextValue = valueIterator.moveNext(); |
188 } | 188 } |
189 if (hasNextKey || hasNextValue) { | 189 if (hasNextKey || hasNextValue) { |
190 throw new ArgumentError("Iterables do not have same length."); | 190 throw new ArgumentError("Iterables do not have same length."); |
191 } | 191 } |
192 } | 192 } |
193 } | 193 } |
OLD | NEW |