Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(46)

Side by Side Diff: sdk/lib/_collection_dev/list.dart

Issue 12383073: Add List.insert. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Use insertBefore and add is-check. Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 * Class implementing the read-operations on [List]. 8 * Class implementing the read-operations on [List].
9 * 9 *
10 * Implements all read-only operations, except [:operator[]:] and [:length:], 10 * Implements all read-only operations, except [:operator[]:] and [:length:],
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 void add(E value) { 83 void add(E value) {
84 throw new UnsupportedError( 84 throw new UnsupportedError(
85 "Cannot add to a fixed-length list"); 85 "Cannot add to a fixed-length list");
86 } 86 }
87 87
88 void addLast(E value) { 88 void addLast(E value) {
89 throw new UnsupportedError( 89 throw new UnsupportedError(
90 "Cannot add to a fixed-length list"); 90 "Cannot add to a fixed-length list");
91 } 91 }
92 92
93 void insert(int index, E value) {
94 throw new UnsupportedError(
95 "Cannot add to a fixed-length list");
96 }
97
93 void addAll(Iterable<E> iterable) { 98 void addAll(Iterable<E> iterable) {
94 throw new UnsupportedError( 99 throw new UnsupportedError(
95 "Cannot add to a fixed-length list"); 100 "Cannot add to a fixed-length list");
96 } 101 }
97 102
98 void remove(E element) { 103 void remove(E element) {
99 throw new UnsupportedError( 104 throw new UnsupportedError(
100 "Cannot remove from a fixed-length list"); 105 "Cannot remove from a fixed-length list");
101 } 106 }
102 107
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 void add(E value) { 169 void add(E value) {
165 throw new UnsupportedError( 170 throw new UnsupportedError(
166 "Cannot add to an unmodifiable list"); 171 "Cannot add to an unmodifiable list");
167 } 172 }
168 173
169 void addLast(E value) { 174 void addLast(E value) {
170 throw new UnsupportedError( 175 throw new UnsupportedError(
171 "Cannot add to an unmodifiable list"); 176 "Cannot add to an unmodifiable list");
172 } 177 }
173 178
179 E insert(int index, E value) {
180 throw new UnsupportedError(
181 "Cannot add to an unmodifiable list");
182 }
183
174 void addAll(Iterable<E> iterable) { 184 void addAll(Iterable<E> iterable) {
175 throw new UnsupportedError( 185 throw new UnsupportedError(
176 "Cannot add to an unmodifiable list"); 186 "Cannot add to an unmodifiable list");
177 } 187 }
178 188
179 void remove(E element) { 189 void remove(E element) {
180 throw new UnsupportedError( 190 throw new UnsupportedError(
181 "Cannot remove from an unmodifiable list"); 191 "Cannot remove from an unmodifiable list");
182 } 192 }
183 193
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 int operator[](int i) => _string.codeUnitAt(i); 280 int operator[](int i) => _string.codeUnitAt(i);
271 } 281 }
272 282
273 class _ListIndicesIterable extends ListIterable<int> { 283 class _ListIndicesIterable extends ListIterable<int> {
274 List _backedList; 284 List _backedList;
275 285
276 _ListIndicesIterable(this._backedList); 286 _ListIndicesIterable(this._backedList);
277 287
278 int get length => _backedList.length; 288 int get length => _backedList.length;
279 int elementAt(int index) { 289 int elementAt(int index) {
280 if (index < 0 || index >= length) throw new RangeError(index); 290 if (index < 0 || index >= length) {
291 throw new RangeError.range(index, 0, length);
292 }
281 return index; 293 return index;
282 } 294 }
283 } 295 }
284 296
285 class ListMapView<E> implements Map<int, E> { 297 class ListMapView<E> implements Map<int, E> {
286 List<E> _values; 298 List<E> _values;
287 299
288 ListMapView(this._values); 300 ListMapView(this._values);
289 301
290 E operator[] (int key) => containsKey(key) ? _values[key] : null; 302 E operator[] (int key) => containsKey(key) ? _values[key] : null;
(...skipping 25 matching lines...) Expand all
316 } 328 }
317 329
318 E remove(int key) { 330 E remove(int key) {
319 throw new UnsupportedError("Cannot modify an unmodifiable map"); 331 throw new UnsupportedError("Cannot modify an unmodifiable map");
320 } 332 }
321 333
322 void clear() { 334 void clear() {
323 throw new UnsupportedError("Cannot modify an unmodifiable map"); 335 throw new UnsupportedError("Cannot modify an unmodifiable map");
324 } 336 }
325 } 337 }
OLDNEW
« no previous file with comments | « samples/swarm/swarm_ui_lib/observable/observable.dart ('k') | sdk/lib/_internal/compiler/implementation/lib/js_array.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698