OLD | NEW |
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 * The [Iterable] interface allows to get an [Iterator] out of an | 8 * The [Iterable] interface allows to get an [Iterator] out of an |
9 * [Iterable] object. | 9 * [Iterable] object. |
10 * | 10 * |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 return true; | 139 return true; |
140 } | 140 } |
141 | 141 |
142 /** | 142 /** |
143 * Convert each element to a [String] and concatenate the strings. | 143 * Convert each element to a [String] and concatenate the strings. |
144 * | 144 * |
145 * Converts each element to a [String] by calling [Object.toString] on it. | 145 * Converts each element to a [String] by calling [Object.toString] on it. |
146 * Then concatenates the strings, optionally separated by the [separator] | 146 * Then concatenates the strings, optionally separated by the [separator] |
147 * string. | 147 * string. |
148 */ | 148 */ |
149 String join([String separator]) { | 149 String join([String separator = ""]) { |
150 StringBuffer buffer = new StringBuffer(); | 150 StringBuffer buffer = new StringBuffer(); |
151 buffer.writeAll(this, separator == null ? "" : separator); | 151 buffer.writeAll(this, separator); |
152 return buffer.toString(); | 152 return buffer.toString(); |
153 } | 153 } |
154 | 154 |
155 /** | 155 /** |
156 * Returns true if one element of this collection satisfies the | 156 * Returns true if one element of this collection satisfies the |
157 * predicate [f]. Returns false otherwise. | 157 * predicate [f]. Returns false otherwise. |
158 */ | 158 */ |
159 bool any(bool f(E element)) { | 159 bool any(bool f(E element)) { |
160 for (E element in this) { | 160 for (E element in this) { |
161 if (f(element)) return true; | 161 if (f(element)) return true; |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 */ | 446 */ |
447 abstract class BidirectionalIterator<T> extends Iterator<T> { | 447 abstract class BidirectionalIterator<T> extends Iterator<T> { |
448 /** | 448 /** |
449 * Move back to the previous element. | 449 * Move back to the previous element. |
450 * | 450 * |
451 * Returns true and updates [current] if successful. Returns false | 451 * Returns true and updates [current] if successful. Returns false |
452 * and sets [current] to null if there is no previous element. | 452 * and sets [current] to null if there is no previous element. |
453 */ | 453 */ |
454 bool movePrevious(); | 454 bool movePrevious(); |
455 } | 455 } |
OLD | NEW |