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._collection.dev; | 5 part of dart._collection.dev; |
6 | 6 |
7 typedef T _Transformation<S, T>(S value); | 7 typedef T _Transformation<S, T>(S value); |
8 | 8 |
9 class MappedIterable<S, T> extends Iterable<T> { | 9 class MappedIterable<S, T> extends Iterable<T> { |
10 final Iterable<S> _iterable; | 10 final Iterable<S> _iterable; |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 | 272 |
273 String join([String separator]) { | 273 String join([String separator]) { |
274 int start = _startIndex; | 274 int start = _startIndex; |
275 int end = _endIndex; | 275 int end = _endIndex; |
276 if (start == end) return ""; | 276 if (start == end) return ""; |
277 StringBuffer buffer = new StringBuffer("${_f(_list[start])}"); | 277 StringBuffer buffer = new StringBuffer("${_f(_list[start])}"); |
278 if (_list.length != length) { | 278 if (_list.length != length) { |
279 throw new ConcurrentModificationError(_list); | 279 throw new ConcurrentModificationError(_list); |
280 } | 280 } |
281 for (int i = start + 1; i < end; i++) { | 281 for (int i = start + 1; i < end; i++) { |
282 buffer.add(separator); | 282 if (separator != null && separator != "") { |
| 283 buffer.add(separator); |
| 284 } |
283 buffer.add("${_f(_list[i])}"); | 285 buffer.add("${_f(_list[i])}"); |
284 if (_list.length != length) { | 286 if (_list.length != length) { |
285 throw new ConcurrentModificationError(_list); | 287 throw new ConcurrentModificationError(_list); |
286 } | 288 } |
287 } | 289 } |
288 return buffer.toString(); | 290 return buffer.toString(); |
289 } | 291 } |
290 | 292 |
291 Iterable<T> where(bool test(T element)) => super.where(test); | 293 Iterable<T> where(bool test(T element)) => super.where(test); |
292 | 294 |
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
674 | 676 |
675 Set toSet() => new Set<E>(); | 677 Set toSet() => new Set<E>(); |
676 } | 678 } |
677 | 679 |
678 /** The always empty iterator. */ | 680 /** The always empty iterator. */ |
679 class EmptyIterator<E> implements Iterator<E> { | 681 class EmptyIterator<E> implements Iterator<E> { |
680 const EmptyIterator(); | 682 const EmptyIterator(); |
681 bool moveNext() => false; | 683 bool moveNext() => false; |
682 E get current => null; | 684 E get current => null; |
683 } | 685 } |
OLD | NEW |