| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 /** | 5 /** |
| 6 * An indexed sequence of elements of the same type. | 6 * An indexed sequence of elements of the same type. |
| 7 * | 7 * |
| 8 * This is a primitive interface that any finite integer-indexable | 8 * This is a primitive interface that any finite integer-indexable |
| 9 * sequence can implement. | 9 * sequence can implement. |
| 10 * It is intended for data structures where access by index is | 10 * It is intended for data structures where access by index is |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 return result; | 71 return result; |
| 72 } | 72 } |
| 73 | 73 |
| 74 bool every(bool f(E element)) { | 74 bool every(bool f(E element)) { |
| 75 for (int i = 0; i < this.length; i++) { | 75 for (int i = 0; i < this.length; i++) { |
| 76 if (!f(this[i])) return false; | 76 if (!f(this[i])) return false; |
| 77 } | 77 } |
| 78 return true; | 78 return true; |
| 79 } | 79 } |
| 80 | 80 |
| 81 bool some(bool f(E element)) { | 81 bool any(bool f(E element)) { |
| 82 for (int i = 0; i < this.length; i++) { | 82 for (int i = 0; i < this.length; i++) { |
| 83 if (f(this[i])) return true; | 83 if (f(this[i])) return true; |
| 84 } | 84 } |
| 85 return false; | 85 return false; |
| 86 } | 86 } |
| 87 | 87 |
| 88 bool get isEmpty { | 88 bool get isEmpty { |
| 89 return this.length == 0; | 89 return this.length == 0; |
| 90 } | 90 } |
| 91 } | 91 } |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 Sequence<E> _sequence; | 195 Sequence<E> _sequence; |
| 196 int _position; | 196 int _position; |
| 197 SequenceIterator(this._sequence) : _position = 0; | 197 SequenceIterator(this._sequence) : _position = 0; |
| 198 bool get hasNext => _position < _sequence.length; | 198 bool get hasNext => _position < _sequence.length; |
| 199 E next() { | 199 E next() { |
| 200 if (hasNext) return _sequence[_position++]; | 200 if (hasNext) return _sequence[_position++]; |
| 201 throw new StateError("No more elements"); | 201 throw new StateError("No more elements"); |
| 202 } | 202 } |
| 203 } | 203 } |
| 204 | 204 |
| OLD | NEW |