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 // TODO(srdjan): Use shared array implementation. | 6 // TODO(srdjan): Use shared array implementation. |
7 class _ObjectArray<E> implements List<E> { | 7 class _ObjectArray<E> implements List<E> { |
8 | 8 |
9 factory _ObjectArray(length) native "ObjectArray_allocate"; | 9 factory _ObjectArray(length) native "ObjectArray_allocate"; |
10 | 10 |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 | 187 |
188 Iterator<E> get iterator { | 188 Iterator<E> get iterator { |
189 return new _FixedSizeArrayIterator<E>(this); | 189 return new _FixedSizeArrayIterator<E>(this); |
190 } | 190 } |
191 | 191 |
192 void add(E element) { | 192 void add(E element) { |
193 throw new UnsupportedError( | 193 throw new UnsupportedError( |
194 "Cannot add to a non-extendable array"); | 194 "Cannot add to a non-extendable array"); |
195 } | 195 } |
196 | 196 |
197 void addLast(E element) { | |
198 add(element); | |
199 } | |
200 | |
201 void addAll(Iterable<E> iterable) { | 197 void addAll(Iterable<E> iterable) { |
202 throw new UnsupportedError( | 198 throw new UnsupportedError( |
203 "Cannot add to a non-extendable array"); | 199 "Cannot add to a non-extendable array"); |
204 } | 200 } |
205 | 201 |
206 void clear() { | 202 void clear() { |
207 throw new UnsupportedError( | 203 throw new UnsupportedError( |
208 "Cannot clear a non-extendable array"); | 204 "Cannot clear a non-extendable array"); |
209 } | 205 } |
210 | 206 |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
439 | 435 |
440 Iterator<E> get iterator { | 436 Iterator<E> get iterator { |
441 return new _FixedSizeArrayIterator<E>(this); | 437 return new _FixedSizeArrayIterator<E>(this); |
442 } | 438 } |
443 | 439 |
444 void add(E element) { | 440 void add(E element) { |
445 throw new UnsupportedError( | 441 throw new UnsupportedError( |
446 "Cannot add to an immutable array"); | 442 "Cannot add to an immutable array"); |
447 } | 443 } |
448 | 444 |
449 void addLast(E element) { | |
450 add(element); | |
451 } | |
452 | |
453 void addAll(Iterable<E> elements) { | 445 void addAll(Iterable<E> elements) { |
454 throw new UnsupportedError( | 446 throw new UnsupportedError( |
455 "Cannot add to an immutable array"); | 447 "Cannot add to an immutable array"); |
456 } | 448 } |
457 | 449 |
458 void clear() { | 450 void clear() { |
459 throw new UnsupportedError( | 451 throw new UnsupportedError( |
460 "Cannot clear an immutable array"); | 452 "Cannot clear an immutable array"); |
461 } | 453 } |
462 | 454 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
525 } | 517 } |
526 _position = _length; | 518 _position = _length; |
527 _current = null; | 519 _current = null; |
528 return false; | 520 return false; |
529 } | 521 } |
530 | 522 |
531 E get current { | 523 E get current { |
532 return _current; | 524 return _current; |
533 } | 525 } |
534 } | 526 } |
OLD | NEW |