| 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.dev; | 5 part of dart._collection.dev; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * Mixin that throws on the length changing operations of [List]. | 8 * Mixin that throws on the length changing operations of [List]. |
| 9 * | 9 * |
| 10 * Intended to mix-in on top of [ListMixin] for fixed-length lists. | 10 * Intended to mix-in on top of [ListMixin] for fixed-length lists. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 void insertAll(int at, Iterable<E> iterable) { | 28 void insertAll(int at, Iterable<E> iterable) { |
| 29 throw new UnsupportedError( | 29 throw new UnsupportedError( |
| 30 "Cannot add to a fixed-length list"); | 30 "Cannot add to a fixed-length list"); |
| 31 } | 31 } |
| 32 | 32 |
| 33 void addAll(Iterable<E> iterable) { | 33 void addAll(Iterable<E> iterable) { |
| 34 throw new UnsupportedError( | 34 throw new UnsupportedError( |
| 35 "Cannot add to a fixed-length list"); | 35 "Cannot add to a fixed-length list"); |
| 36 } | 36 } |
| 37 | 37 |
| 38 void remove(E element) { | 38 bool remove(E element) { |
| 39 throw new UnsupportedError( | 39 throw new UnsupportedError( |
| 40 "Cannot remove from a fixed-length list"); | 40 "Cannot remove from a fixed-length list"); |
| 41 } | 41 } |
| 42 | 42 |
| 43 void removeAll(Iterable elements) { | 43 void removeAll(Iterable elements) { |
| 44 throw new UnsupportedError( | 44 throw new UnsupportedError( |
| 45 "Cannot remove from a fixed-length list"); | 45 "Cannot remove from a fixed-length list"); |
| 46 } | 46 } |
| 47 | 47 |
| 48 void retainAll(Iterable elements) { | 48 void retainAll(Iterable elements) { |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 "Cannot change the length of an unmodifiable list"); | 105 "Cannot change the length of an unmodifiable list"); |
| 106 } | 106 } |
| 107 | 107 |
| 108 void setAll(int at, Iterable<E> iterable) { | 108 void setAll(int at, Iterable<E> iterable) { |
| 109 throw new UnsupportedError( | 109 throw new UnsupportedError( |
| 110 "Cannot modify an unmodifiable list"); | 110 "Cannot modify an unmodifiable list"); |
| 111 } | 111 } |
| 112 | 112 |
| 113 void add(E value) { | 113 void add(E value) { |
| 114 throw new UnsupportedError( | 114 throw new UnsupportedError( |
| 115 "Cannot add to an unmodifiable list"); | 115 "Cannot add to an unmodifiable list"); |
| 116 } | 116 } |
| 117 | 117 |
| 118 E insert(int index, E value) { | 118 E insert(int index, E value) { |
| 119 throw new UnsupportedError( | 119 throw new UnsupportedError( |
| 120 "Cannot add to an unmodifiable list"); | 120 "Cannot add to an unmodifiable list"); |
| 121 } | 121 } |
| 122 | 122 |
| 123 void insertAll(int at, Iterable<E> iterable) { | 123 void insertAll(int at, Iterable<E> iterable) { |
| 124 throw new UnsupportedError( | 124 throw new UnsupportedError( |
| 125 "Cannot add to an unmodifiable list"); | 125 "Cannot add to an unmodifiable list"); |
| 126 } | 126 } |
| 127 | 127 |
| 128 void addAll(Iterable<E> iterable) { | 128 void addAll(Iterable<E> iterable) { |
| 129 throw new UnsupportedError( | 129 throw new UnsupportedError( |
| 130 "Cannot add to an unmodifiable list"); | 130 "Cannot add to an unmodifiable list"); |
| 131 } | 131 } |
| 132 | 132 |
| 133 void remove(E element) { | 133 bool remove(E element) { |
| 134 throw new UnsupportedError( | 134 throw new UnsupportedError( |
| 135 "Cannot remove from an unmodifiable list"); | 135 "Cannot remove from an unmodifiable list"); |
| 136 } | 136 } |
| 137 | 137 |
| 138 void removeAll(Iterable elements) { | 138 void removeAll(Iterable elements) { |
| 139 throw new UnsupportedError( | 139 throw new UnsupportedError( |
| 140 "Cannot remove from an unmodifiable list"); | 140 "Cannot remove from an unmodifiable list"); |
| 141 } | 141 } |
| 142 | 142 |
| 143 void retainAll(Iterable elements) { | 143 void retainAll(Iterable elements) { |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 } | 269 } |
| 270 | 270 |
| 271 class ReversedListIterable<E> extends ListIterable<E> { | 271 class ReversedListIterable<E> extends ListIterable<E> { |
| 272 Iterable<E> _source; | 272 Iterable<E> _source; |
| 273 ReversedListIterable(this._source); | 273 ReversedListIterable(this._source); |
| 274 | 274 |
| 275 int get length => _source.length; | 275 int get length => _source.length; |
| 276 | 276 |
| 277 E elementAt(int index) => _source.elementAt(_source.length - 1 - index); | 277 E elementAt(int index) => _source.elementAt(_source.length - 1 - index); |
| 278 } | 278 } |
| OLD | NEW |