| 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 part of dart.core; | 5 part of dart.core; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * A [List] is an indexable collection with a length. It can be of | 8 * A [List] is an indexable collection with a length. It can be of |
| 9 * fixed size or extendable. | 9 * fixed size or extendable. |
| 10 */ | 10 */ |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 _current = null; | 361 _current = null; |
| 362 return false; | 362 return false; |
| 363 } | 363 } |
| 364 | 364 |
| 365 E get current => _current; | 365 E get current => _current; |
| 366 } | 366 } |
| 367 | 367 |
| 368 class MappedList<S, T> extends NonExtensibleListMixin<T> { | 368 class MappedList<S, T> extends NonExtensibleListMixin<T> { |
| 369 final List<S> _list; | 369 final List<S> _list; |
| 370 // TODO(ahe): Restore type when feature is implemented in dart2js | 370 // TODO(ahe): Restore type when feature is implemented in dart2js |
| 371 // checked mode. | 371 // checked mode. http://dartbug.com/7733 |
| 372 final /* _Transformation<S, T> */ _f; | 372 final /* _Transformation<S, T> */ _f; |
| 373 | 373 |
| 374 MappedList(this._list, T this._f(S element)); | 374 MappedList(this._list, T this._f(S element)); |
| 375 | 375 |
| 376 T operator[](int index) => _f(_list[index]); | 376 T operator[](int index) => _f(_list[index]); |
| 377 int get length => _list.length; | 377 int get length => _list.length; |
| 378 } | 378 } |
| 379 | 379 |
| 380 /** | 380 /** |
| 381 * An immutable view of a [List]. | 381 * An immutable view of a [List]. |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 | 426 |
| 427 ListView<E> take(int takeCount) { | 427 ListView<E> take(int takeCount) { |
| 428 if (takeCount is! int || takeCount < 0) { | 428 if (takeCount is! int || takeCount < 0) { |
| 429 throw new ArgumentError(takeCount); | 429 throw new ArgumentError(takeCount); |
| 430 } | 430 } |
| 431 int newLength = takeCount; | 431 int newLength = takeCount; |
| 432 if (_length != null && takeCount > _length) newLength = _length; | 432 if (_length != null && takeCount > _length) newLength = _length; |
| 433 return new ListView(_list, _offset, newLength); | 433 return new ListView(_list, _offset, newLength); |
| 434 } | 434 } |
| 435 } | 435 } |
| OLD | NEW |