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 731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
742 Set toSet() => new Set<E>(); | 742 Set toSet() => new Set<E>(); |
743 } | 743 } |
744 | 744 |
745 /** The always empty iterator. */ | 745 /** The always empty iterator. */ |
746 class EmptyIterator<E> implements Iterator<E> { | 746 class EmptyIterator<E> implements Iterator<E> { |
747 const EmptyIterator(); | 747 const EmptyIterator(); |
748 bool moveNext() => false; | 748 bool moveNext() => false; |
749 E get current => null; | 749 E get current => null; |
750 } | 750 } |
751 | 751 |
752 /** An [Iterator] that can move in both directions. */ | |
753 abstract class BidirectionalIterator<T> implements Iterator<T> { | |
754 bool movePrevious(); | |
755 } | |
756 | |
757 | |
758 /** | 752 /** |
759 * Creates errors throw by [Iterable] when the element count is wrong. | 753 * Creates errors throw by [Iterable] when the element count is wrong. |
760 */ | 754 */ |
761 abstract class IterableElementError { | 755 abstract class IterableElementError { |
762 /** Error thrown thrown by, e.g., [Iterable.first] when there is no result. */ | 756 /** Error thrown thrown by, e.g., [Iterable.first] when there is no result. */ |
763 static StateError noElement() => new StateError("No element"); | 757 static StateError noElement() => new StateError("No element"); |
764 /** Error thrown by, e.g., [Iterable.single] if there are too many results. */ | 758 /** Error thrown by, e.g., [Iterable.single] if there are too many results. */ |
765 static StateError tooMany() => new StateError("Too many elements"); | 759 static StateError tooMany() => new StateError("Too many elements"); |
766 /** Error thrown by, e.g., [List.setRange] if there are too few elements. */ | 760 /** Error thrown by, e.g., [List.setRange] if there are too few elements. */ |
767 static StateError tooFew() => new StateError("Too few elements"); | 761 static StateError tooFew() => new StateError("Too few elements"); |
768 } | 762 } |
OLD | NEW |