| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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.collection; | 5 part of dart.collection; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * Abstract implementation of a list. | 8 * Abstract implementation of a list. |
| 9 * | 9 * |
| 10 * All operations are defined in terms of `length`, `operator[]`, | 10 * All operations are defined in terms of `length`, `operator[]`, |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 for (int i = 0; i < length; i++) { | 38 for (int i = 0; i < length; i++) { |
| 39 action(this[i]); | 39 action(this[i]); |
| 40 if (length != this.length) { | 40 if (length != this.length) { |
| 41 throw new ConcurrentModificationError(this); | 41 throw new ConcurrentModificationError(this); |
| 42 } | 42 } |
| 43 } | 43 } |
| 44 } | 44 } |
| 45 | 45 |
| 46 bool get isEmpty => length == 0; | 46 bool get isEmpty => length == 0; |
| 47 | 47 |
| 48 bool get isNotEmpty => !isEmpty; |
| 49 |
| 48 E get first { | 50 E get first { |
| 49 if (length == 0) throw new StateError("No elements"); | 51 if (length == 0) throw new StateError("No elements"); |
| 50 return this[0]; | 52 return this[0]; |
| 51 } | 53 } |
| 52 | 54 |
| 53 E get last { | 55 E get last { |
| 54 if (length == 0) throw new StateError("No elements"); | 56 if (length == 0) throw new StateError("No elements"); |
| 55 return this[length - 1]; | 57 return this[length - 1]; |
| 56 } | 58 } |
| 57 | 59 |
| (...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 470 for (E element in iterable) { | 472 for (E element in iterable) { |
| 471 this[index++] = element; | 473 this[index++] = element; |
| 472 } | 474 } |
| 473 } | 475 } |
| 474 } | 476 } |
| 475 | 477 |
| 476 Iterable<E> get reversed => new ReversedListIterable(this); | 478 Iterable<E> get reversed => new ReversedListIterable(this); |
| 477 | 479 |
| 478 String toString() => ToString.iterableToString(this); | 480 String toString() => ToString.iterableToString(this); |
| 479 } | 481 } |
| OLD | NEW |