OLD | NEW |
1 part of dart.collection; | 1 part of dart.collection; |
2 class HasNextIterator<E> {static const int _HAS_NEXT_AND_NEXT_IN_CURRENT = 0; | 2 class HasNextIterator<E> {static const int _HAS_NEXT_AND_NEXT_IN_CURRENT = 0; |
3 static const int _NO_NEXT = 1; | 3 static const int _NO_NEXT = 1; |
4 static const int _NOT_MOVED_YET = 2; | 4 static const int _NOT_MOVED_YET = 2; |
5 Iterator _iterator; | 5 Iterator _iterator; |
6 int _state = _NOT_MOVED_YET; | 6 int _state = _NOT_MOVED_YET; |
7 HasNextIterator(this._iterator); | 7 HasNextIterator(this._iterator); |
8 bool get hasNext { | 8 bool get hasNext { |
9 if (_state == _NOT_MOVED_YET) _move(); | 9 if (_state == _NOT_MOVED_YET) _move(); |
10 return _state == _HAS_NEXT_AND_NEXT_IN_CURRENT; | 10 return _state == _HAS_NEXT_AND_NEXT_IN_CURRENT; |
11 } | 11 } |
12 E next() { | 12 E next() { |
13 if (!hasNext) throw new StateError("No more elements"); | 13 if (!hasNext) throw new StateError("No more elements"); |
14 assert (_state == _HAS_NEXT_AND_NEXT_IN_CURRENT); E result = DDC$RT.cast(_ite
rator.current, dynamic, E, "CastGeneral", """line 33, column 16 of dart:collecti
on/iterator.dart: """, _iterator.current is E, false); | 14 assert (_state == _HAS_NEXT_AND_NEXT_IN_CURRENT); E result = DEVC$RT.cast(_it
erator.current, dynamic, E, "CastGeneral", """line 33, column 16 of dart:collect
ion/iterator.dart: """, _iterator.current is E, false); |
15 _move(); | 15 _move(); |
16 return result; | 16 return result; |
17 } | 17 } |
18 void _move() { | 18 void _move() { |
19 if (_iterator.moveNext()) { | 19 if (_iterator.moveNext()) { |
20 _state = _HAS_NEXT_AND_NEXT_IN_CURRENT; | 20 _state = _HAS_NEXT_AND_NEXT_IN_CURRENT; |
21 } | 21 } |
22 else { | 22 else { |
23 _state = _NO_NEXT; | 23 _state = _NO_NEXT; |
24 } | 24 } |
25 } | 25 } |
26 } | 26 } |
OLD | NEW |