Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(445)

Side by Side Diff: pkg/mdv_observe/lib/src/observable_map.dart

Issue 15263004: Adding isNotEmpty property to collection and string. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix template generation Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | pkg/serialization/lib/src/serialization_helpers.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « no previous file | pkg/serialization/lib/src/serialization_helpers.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698