| 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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 * Converts each element to a [String] by calling [Object.toString] on it. | 126 * Converts each element to a [String] by calling [Object.toString] on it. |
| 127 * Then concatenates the strings, optionally separated by the [separator] | 127 * Then concatenates the strings, optionally separated by the [separator] |
| 128 * string. | 128 * string. |
| 129 */ | 129 */ |
| 130 String join([String separator]) { | 130 String join([String separator]) { |
| 131 Iterator<E> iterator = this.iterator; | 131 Iterator<E> iterator = this.iterator; |
| 132 if (!iterator.moveNext()) return ""; | 132 if (!iterator.moveNext()) return ""; |
| 133 StringBuffer buffer = new StringBuffer(); | 133 StringBuffer buffer = new StringBuffer(); |
| 134 if (separator == null || separator == "") { | 134 if (separator == null || separator == "") { |
| 135 do { | 135 do { |
| 136 buffer.add("${iterator.current}"); | 136 buffer.write("${iterator.current}"); |
| 137 } while (iterator.moveNext()); | 137 } while (iterator.moveNext()); |
| 138 } else { | 138 } else { |
| 139 buffer.add("${iterator.current}"); | 139 buffer.write("${iterator.current}"); |
| 140 while (iterator.moveNext()) { | 140 while (iterator.moveNext()) { |
| 141 buffer.add(separator); | 141 buffer.write(separator); |
| 142 buffer.add("${iterator.current}"); | 142 buffer.write("${iterator.current}"); |
| 143 } | 143 } |
| 144 } | 144 } |
| 145 return buffer.toString(); | 145 return buffer.toString(); |
| 146 } | 146 } |
| 147 | 147 |
| 148 /** | 148 /** |
| 149 * Returns true if one element of this collection satisfies the | 149 * Returns true if one element of this collection satisfies the |
| 150 * predicate [f]. Returns false otherwise. | 150 * predicate [f]. Returns false otherwise. |
| 151 */ | 151 */ |
| 152 bool any(bool f(E element)) { | 152 bool any(bool f(E element)) { |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 */ | 433 */ |
| 434 abstract class BidirectionalIterator<T> extends Iterator<T> { | 434 abstract class BidirectionalIterator<T> extends Iterator<T> { |
| 435 /** | 435 /** |
| 436 * Move back to the previous element. | 436 * Move back to the previous element. |
| 437 * | 437 * |
| 438 * Returns true and updates [current] if successful. Returns false | 438 * Returns true and updates [current] if successful. Returns false |
| 439 * and sets [current] to null if there is no previous element. | 439 * and sets [current] to null if there is no previous element. |
| 440 */ | 440 */ |
| 441 bool movePrevious(); | 441 bool movePrevious(); |
| 442 } | 442 } |
| OLD | NEW |