Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(146)

Side by Side Diff: lib/html/src/_ListIterators.dart

Issue 11269045: Convert NoMoreElementsException and EmptyQueueException to StateError. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 // Iterator for arrays with fixed size. 5 // Iterator for arrays with fixed size.
6 class _FixedSizeListIterator<T> extends _VariableSizeListIterator<T> { 6 class _FixedSizeListIterator<T> extends _VariableSizeListIterator<T> {
7 _FixedSizeListIterator(List<T> array) 7 _FixedSizeListIterator(List<T> array)
8 : super(array), 8 : super(array),
9 _length = array.length; 9 _length = array.length;
10 10
11 bool get hasNext => _length > _pos; 11 bool get hasNext => _length > _pos;
12 12
13 final int _length; // Cache array length for faster access. 13 final int _length; // Cache array length for faster access.
14 } 14 }
15 15
16 // Iterator for arrays with variable size. 16 // Iterator for arrays with variable size.
17 class _VariableSizeListIterator<T> implements Iterator<T> { 17 class _VariableSizeListIterator<T> implements Iterator<T> {
18 _VariableSizeListIterator(List<T> array) 18 _VariableSizeListIterator(List<T> array)
19 : _array = array, 19 : _array = array,
20 _pos = 0; 20 _pos = 0;
21 21
22 bool get hasNext => _array.length > _pos; 22 bool get hasNext => _array.length > _pos;
23 23
24 T next() { 24 T next() {
25 if (!hasNext) { 25 if (!hasNext) {
26 throw const NoMoreElementsException(); 26 throw new StateError("No more elements");
27 } 27 }
28 return _array[_pos++]; 28 return _array[_pos++];
29 } 29 }
30 30
31 final List<T> _array; 31 final List<T> _array;
32 int _pos; 32 int _pos;
33 } 33 }
OLDNEW
« no previous file with comments | « lib/html/dartium/html_dartium.dart ('k') | lib/html/templates/html/impl/impl_DocumentFragment.darttemplate » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698