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

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

Issue 288103003: Change Set.toSet to always return a set with the same behavior. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Update html5lib pubspec version to 0.12.0-dev Created 6 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
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 object that uses an [Iterator] to serve objects one at a time. 8 * An object that uses an [Iterator] to serve objects one at a time.
9 * 9 *
10 * You can iterate over all objects served by an Iterable object 10 * You can iterate over all objects served by an Iterable object
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 * The resulting Iterable runs through the elements returned 88 * The resulting Iterable runs through the elements returned
89 * by [f] for each element of this, in order. 89 * by [f] for each element of this, in order.
90 * 90 *
91 * The returned [Iterable] is lazy, and calls [f] for each element 91 * The returned [Iterable] is lazy, and calls [f] for each element
92 * of this every time it's iterated. 92 * of this every time it's iterated.
93 */ 93 */
94 Iterable expand(Iterable f(E element)); 94 Iterable expand(Iterable f(E element));
95 95
96 /** 96 /**
97 * Returns true if the collection contains an element equal to [element]. 97 * Returns true if the collection contains an element equal to [element].
98 *
99 * The equality used to determine wheter [element] is equal to an element of
100 * the iterable, depends on the type of iterable.
101 * For example, a [Set] may have a custom equality
102 * (see, e.g., [Set.identical]) that its `contains` uses.
103 * Likewise the `Iterable` returned by a [Map.keys] call
104 * will likely use the same equality that the `Map` uses for keys.
98 */ 105 */
99 bool contains(Object element); 106 bool contains(Object element);
100 107
101 /** 108 /**
102 * Applies the function [f] to each element of this collection. 109 * Applies the function [f] to each element of this collection.
103 */ 110 */
104 void forEach(void f(E element)); 111 void forEach(void f(E element));
105 112
106 /** 113 /**
107 * Reduces a collection to a single value by iteratively combining elements 114 * Reduces a collection to a single value by iteratively combining elements
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 164
158 /** 165 /**
159 * Creates a [List] containing the elements of this [Iterable]. 166 * Creates a [List] containing the elements of this [Iterable].
160 * 167 *
161 * The elements are in iteration order. The list is fixed-length 168 * The elements are in iteration order. The list is fixed-length
162 * if [growable] is false. 169 * if [growable] is false.
163 */ 170 */
164 List<E> toList({ bool growable: true }); 171 List<E> toList({ bool growable: true });
165 172
166 /** 173 /**
167 * Creates a [Set] containing the elements of this [Iterable]. 174 * Creates a [Set] containing the same elements as this iterable.
175 *
176 * The returned `Set` will have the same `Set.length`
177 * as the `length` of this iterable,
178 * and its `Set.contains` will return the same result
179 * as the `contains` of this iterable.
180 * The order of the elements may be different.
168 */ 181 */
169 Set<E> toSet(); 182 Set<E> toSet();
170 183
171 /** 184 /**
172 * Returns the number of elements in [this]. 185 * Returns the number of elements in [this].
173 * 186 *
174 * Counting all elements may be involve running through all elements and can 187 * Counting all elements may be involve running through all elements and can
175 * therefore be slow. 188 * therefore be slow.
176 */ 189 */
177 int get length; 190 int get length;
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 */ 366 */
354 abstract class BidirectionalIterator<E> implements Iterator<E> { 367 abstract class BidirectionalIterator<E> implements Iterator<E> {
355 /** 368 /**
356 * Move back to the previous element. 369 * Move back to the previous element.
357 * 370 *
358 * Returns true and updates [current] if successful. Returns false 371 * Returns true and updates [current] if successful. Returns false
359 * and sets [current] to null if there is no previous element. 372 * and sets [current] to null if there is no previous element.
360 */ 373 */
361 bool movePrevious(); 374 bool movePrevious();
362 } 375 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698