@@ -69,14 +69,10 @@ class CanonicalizedMap<C, K, V> implements Map<K, V> {
6969 other.forEach ((key, value) => this [key] = value);
7070 }
7171
72- // TODO: Dart 2.0 requires this method to be implemented.
73- void addEntries (Iterable <Object > entries) {
74- // Change Iterable<Object> to Iterable<MapEntry<K, V>> when
75- // the MapEntry class has been added.
76- throw new UnimplementedError ('addEntries' );
77- }
72+ void addEntries (Iterable <MapEntry <K , V >> entries) =>
73+ _base.addEntries (entries.map (
74+ (e) => new MapEntry (_canonicalize (e.key), new Pair (e.key, e.value))));
7875
79- // TODO: Dart 2.0 requires this method to be implemented.
8076 Map <K2 , V2 > cast <K2 , V2 >() {
8177 throw new UnimplementedError ('cast' );
8278 }
@@ -93,12 +89,8 @@ class CanonicalizedMap<C, K, V> implements Map<K, V> {
9389 bool containsValue (Object value) =>
9490 _base.values.any ((pair) => pair.last == value);
9591
96- // TODO: Dart 2.0 requires this method to be implemented.
97- Iterable <Null > get entries {
98- // Change Iterable<Null> to Iterable<MapEntry<K, V>> when
99- // the MapEntry class has been added.
100- throw new UnimplementedError ('entries' );
101- }
92+ Iterable <MapEntry <K , V >> get entries =>
93+ _base.entries.map ((e) => new MapEntry (e.value.first, e.value.last));
10294
10395 void forEach (void f (K key, V value)) {
10496 _base.forEach ((key, pair) => f (pair.first, pair.last));
0 commit comments