| 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.dom.html; | 5 part of dart.dom.html; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * A list which just wraps another list, for either intercepting list calls or | 8 * A list which just wraps another list, for either intercepting list calls or |
| 9 * retyping the list (for example, from List<A> to List<B> where B extends A). | 9 * retyping the list (for example, from List<A> to List<B> where B extends A). |
| 10 */ | 10 */ |
| 11 class _WrappedList<E> extends ListBase<E> { | 11 class _WrappedList<E> extends ListBase<E> { |
| 12 final List _list; | 12 final List _list; |
| 13 | 13 |
| 14 _WrappedList(this._list); | 14 _WrappedList(this._list); |
| 15 | 15 |
| 16 // Iterable APIs | 16 // Iterable APIs |
| 17 | 17 |
| 18 Iterator<E> get iterator => new _WrappedIterator(_list.iterator); | 18 Iterator<E> get iterator => new _WrappedIterator(_list.iterator); |
| 19 | 19 |
| 20 int get length => _list.length; | 20 int get length => _list.length; |
| 21 | 21 |
| 22 // Collection APIs | 22 // Collection APIs |
| 23 | 23 |
| 24 void add(E element) { _list.add(element); } | 24 void add(E element) { _list.add(element); } |
| 25 | 25 |
| 26 void remove(Object element) { _list.remove(element); } | 26 bool remove(Object element) => _list.remove(element); |
| 27 | 27 |
| 28 void clear() { _list.clear(); } | 28 void clear() { _list.clear(); } |
| 29 | 29 |
| 30 // List APIs | 30 // List APIs |
| 31 | 31 |
| 32 E operator [](int index) => _list[index]; | 32 E operator [](int index) => _list[index]; |
| 33 | 33 |
| 34 void operator []=(int index, E value) { _list[index] = value; } | 34 void operator []=(int index, E value) { _list[index] = value; } |
| 35 | 35 |
| 36 void set length(int newLength) { _list.length = newLength; } | 36 void set length(int newLength) { _list.length = newLength; } |
| (...skipping 30 matching lines...) Expand all Loading... |
| 67 Iterator _iterator; | 67 Iterator _iterator; |
| 68 | 68 |
| 69 _WrappedIterator(this._iterator); | 69 _WrappedIterator(this._iterator); |
| 70 | 70 |
| 71 bool moveNext() { | 71 bool moveNext() { |
| 72 return _iterator.moveNext(); | 72 return _iterator.moveNext(); |
| 73 } | 73 } |
| 74 | 74 |
| 75 E get current => _iterator.current; | 75 E get current => _iterator.current; |
| 76 } | 76 } |
| OLD | NEW |