| OLD | NEW |
| 1 // -- start List<$E> mixins. | 1 // -- start List<$E> mixins. |
| 2 // $E is the element type. | 2 // $E is the element type. |
| 3 | 3 |
| 4 // From Iterable<$E>: | 4 // From Iterable<$E>: |
| 5 | 5 |
| 6 Iterator<$E> get iterator { | 6 Iterator<$E> get iterator { |
| 7 // Note: NodeLists are not fixed size. And most probably length shouldn't | 7 // Note: NodeLists are not fixed size. And most probably length shouldn't |
| 8 // be cached in both iterator _and_ forEach method. For now caching it | 8 // be cached in both iterator _and_ forEach method. For now caching it |
| 9 // for consistency. | 9 // for consistency. |
| 10 return new FixedSizeListIterator<$E>(this); | 10 return new FixedSizeListIterator<$E>(this); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 $endif | 93 $endif |
| 94 | 94 |
| 95 $if DEFINE_CLEAR | 95 $if DEFINE_CLEAR |
| 96 void clear() { | 96 void clear() { |
| 97 throw new UnsupportedError("Cannot clear immutable List."); | 97 throw new UnsupportedError("Cannot clear immutable List."); |
| 98 } | 98 } |
| 99 $else | 99 $else |
| 100 // clear() defined by IDL. | 100 // clear() defined by IDL. |
| 101 $endif | 101 $endif |
| 102 | 102 |
| 103 List<$E> get reversed => | 103 List<$E> get reversed { |
| 104 new ReversedListView<$E>(this, 0, null); | 104 return IterableMixinWorkaround.reversedList(this); |
| 105 } |
| 105 | 106 |
| 106 void sort([int compare($E a, $E b)]) { | 107 void sort([int compare($E a, $E b)]) { |
| 107 throw new UnsupportedError("Cannot sort immutable List."); | 108 throw new UnsupportedError("Cannot sort immutable List."); |
| 108 } | 109 } |
| 109 | 110 |
| 110 int indexOf($E element, [int start = 0]) => | 111 int indexOf($E element, [int start = 0]) => |
| 111 Lists.indexOf(this, element, start, this.length); | 112 Lists.indexOf(this, element, start, this.length); |
| 112 | 113 |
| 113 int lastIndexOf($E element, [int start]) { | 114 int lastIndexOf($E element, [int start]) { |
| 114 if (start == null) start = length - 1; | 115 if (start == null) start = length - 1; |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 } | 175 } |
| 175 | 176 |
| 176 void insertRange(int start, int rangeLength, [$E initialValue]) { | 177 void insertRange(int start, int rangeLength, [$E initialValue]) { |
| 177 throw new UnsupportedError("Cannot insertRange on immutable List."); | 178 throw new UnsupportedError("Cannot insertRange on immutable List."); |
| 178 } | 179 } |
| 179 | 180 |
| 180 List<$E> getRange(int start, int rangeLength) => | 181 List<$E> getRange(int start, int rangeLength) => |
| 181 Lists.getRange(this, start, rangeLength, <$E>[]); | 182 Lists.getRange(this, start, rangeLength, <$E>[]); |
| 182 | 183 |
| 183 // -- end List<$E> mixins. | 184 // -- end List<$E> mixins. |
| OLD | NEW |