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

Side by Side Diff: sdk/lib/core/map.dart

Issue 26681002: Add EfficientLength marker interface to some iterabels. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Also document Map.length is efficient, while we are at it. Created 7 years, 2 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 | « sdk/lib/core/list.dart ('k') | sdk/lib/core/set.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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 dart.core; 5 part of dart.core;
6 6
7 /** 7 /**
8 * An unordered collection of key-value pairs, from which you retrieve a value 8 * An unordered collection of key-value pairs, from which you retrieve a value
9 * by using its associated key. 9 * by using its associated key.
10 * 10 *
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 146
147 /** 147 /**
148 * Applies [f] to each {key, value} pair of the map. 148 * Applies [f] to each {key, value} pair of the map.
149 * 149 *
150 * It is an error to add or remove keys from the map during iteration. 150 * It is an error to add or remove keys from the map during iteration.
151 */ 151 */
152 void forEach(void f(K key, V value)); 152 void forEach(void f(K key, V value));
153 153
154 /** 154 /**
155 * The keys of [this]. 155 * The keys of [this].
156 *
157 * The `contains` method of the returned iterable is as efficient as
158 * [containsKey].
159 *
160 * The returned iterable is guaranteed to have the same `length` as this map,
161 * and its `length` getter is efficient.
156 */ 162 */
157 Iterable<K> get keys; 163 Iterable<K> get keys;
158 164
159 /** 165 /**
160 * The values of [this]. 166 * The values of [this].
167 *
168 * This iterable is guaranteed to have the same `length` as this map,
169 * and its `length` getter is efficient.
161 */ 170 */
162 Iterable<V> get values; 171 Iterable<V> get values;
163 172
164 /** 173 /**
165 * The number of {key, value} pairs in the map. 174 * The number of {key, value} pairs in the map.
175 *
176 * This operation is efficient, and doesn't require iterating and counting
177 * the entries.
166 */ 178 */
167 int get length; 179 int get length;
168 180
169 /** 181 /**
170 * Returns true if there is no {key, value} pair in the map. 182 * Returns true if there is no {key, value} pair in the map.
171 */ 183 */
172 bool get isEmpty; 184 bool get isEmpty;
173 185
174 /** 186 /**
175 * Returns true if there is at least one {key, value} pair in the map. 187 * Returns true if there is at least one {key, value} pair in the map.
176 */ 188 */
177 bool get isNotEmpty; 189 bool get isNotEmpty;
178 } 190 }
OLDNEW
« no previous file with comments | « sdk/lib/core/list.dart ('k') | sdk/lib/core/set.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698