OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 mdv_observe; | 5 part of mdv_observe; |
6 | 6 |
7 // TODO(jmesserly): this needs to be faster. We currently require multiple | 7 // TODO(jmesserly): this needs to be faster. We currently require multiple |
8 // lookups per key to get the old value. | 8 // lookups per key to get the old value. |
9 // TODO(jmesserly): this doesn't implement the precise interfaces like | 9 // TODO(jmesserly): this doesn't implement the precise interfaces like |
10 // LinkedHashMap, SplayTreeMap or HashMap. However it can use them for the | 10 // LinkedHashMap, SplayTreeMap or HashMap. However it can use them for the |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 } | 85 } |
86 | 86 |
87 Iterable<K> get keys => _map.keys; | 87 Iterable<K> get keys => _map.keys; |
88 | 88 |
89 Iterable<V> get values => _map.values; | 89 Iterable<V> get values => _map.values; |
90 | 90 |
91 int get length =>_map.length; | 91 int get length =>_map.length; |
92 | 92 |
93 bool get isEmpty => length == 0; | 93 bool get isEmpty => length == 0; |
94 | 94 |
| 95 bool get isNotEmpty => !isEmpty; |
| 96 |
95 bool containsValue(V value) => _map.containsValue(value); | 97 bool containsValue(V value) => _map.containsValue(value); |
96 | 98 |
97 bool containsKey(K key) => _map.containsKey(key); | 99 bool containsKey(K key) => _map.containsKey(key); |
98 | 100 |
99 V operator [](K key) => _map[key]; | 101 V operator [](K key) => _map[key]; |
100 | 102 |
101 void operator []=(K key, V value) { | 103 void operator []=(K key, V value) { |
102 int len = _map.length; | 104 int len = _map.length; |
103 V oldValue = _map[key]; | 105 V oldValue = _map[key]; |
104 _map[key] = value; | 106 _map[key] = value; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 }); | 142 }); |
141 notifyPropertyChange(_LENGTH, len, 0); | 143 notifyPropertyChange(_LENGTH, len, 0); |
142 } | 144 } |
143 _map.clear(); | 145 _map.clear(); |
144 } | 146 } |
145 | 147 |
146 void forEach(void f(K key, V value)) => _map.forEach(f); | 148 void forEach(void f(K key, V value)) => _map.forEach(f); |
147 | 149 |
148 String toString() => Maps.mapToString(this); | 150 String toString() => Maps.mapToString(this); |
149 } | 151 } |
OLD | NEW |