| 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._internal; | 5 part of dart._internal; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * Marker interface for [Iterable] subclasses that have an efficient | 8 * Marker interface for [Iterable] subclasses that have an efficient |
| 9 * [length] implementation. | 9 * [length] implementation. |
| 10 */ | 10 */ |
| (...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 733 | 733 |
| 734 Iterable<E> skipWhile(bool test(E element)) => this; | 734 Iterable<E> skipWhile(bool test(E element)) => this; |
| 735 | 735 |
| 736 Iterable<E> take(int count) { | 736 Iterable<E> take(int count) { |
| 737 RangeError.checkNotNegative(count, "count"); | 737 RangeError.checkNotNegative(count, "count"); |
| 738 return this; | 738 return this; |
| 739 } | 739 } |
| 740 | 740 |
| 741 Iterable<E> takeWhile(bool test(E element)) => this; | 741 Iterable<E> takeWhile(bool test(E element)) => this; |
| 742 | 742 |
| 743 List toList({ bool growable: true }) => growable ? <E>[] : new List<E>(0); | 743 List<E> toList({ bool growable: true }) => growable ? <E>[] : new List<E>(0); |
| 744 | 744 |
| 745 Set toSet() => new Set<E>(); | 745 Set<E> toSet() => new Set<E>(); |
| 746 } | 746 } |
| 747 | 747 |
| 748 /** The always empty iterator. */ | 748 /** The always empty iterator. */ |
| 749 class EmptyIterator<E> implements Iterator<E> { | 749 class EmptyIterator<E> implements Iterator<E> { |
| 750 const EmptyIterator(); | 750 const EmptyIterator(); |
| 751 bool moveNext() => false; | 751 bool moveNext() => false; |
| 752 E get current => null; | 752 E get current => null; |
| 753 } | 753 } |
| 754 | 754 |
| 755 /** An [Iterator] that can move in both directions. */ | 755 /** An [Iterator] that can move in both directions. */ |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1160 * Creates errors throw by [Iterable] when the element count is wrong. | 1160 * Creates errors throw by [Iterable] when the element count is wrong. |
| 1161 */ | 1161 */ |
| 1162 abstract class IterableElementError { | 1162 abstract class IterableElementError { |
| 1163 /** Error thrown thrown by, e.g., [Iterable.first] when there is no result. */ | 1163 /** Error thrown thrown by, e.g., [Iterable.first] when there is no result. */ |
| 1164 static StateError noElement() => new StateError("No element"); | 1164 static StateError noElement() => new StateError("No element"); |
| 1165 /** Error thrown by, e.g., [Iterable.single] if there are too many results. */ | 1165 /** Error thrown by, e.g., [Iterable.single] if there are too many results. */ |
| 1166 static StateError tooMany() => new StateError("Too many elements"); | 1166 static StateError tooMany() => new StateError("Too many elements"); |
| 1167 /** Error thrown by, e.g., [List.setRange] if there are too few elements. */ | 1167 /** Error thrown by, e.g., [List.setRange] if there are too few elements. */ |
| 1168 static StateError tooFew() => new StateError("Too few elements"); | 1168 static StateError tooFew() => new StateError("Too few elements"); |
| 1169 } | 1169 } |
| OLD | NEW |