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

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

Issue 11931034: Add methods to Collection. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 7 years, 11 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
« no previous file with comments | « sdk/lib/core/collection.dart ('k') | sdk/lib/core/queue.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 part of dart.core; 5 part of dart.core;
6 6
7 /** 7 /**
8 * A [List] is an indexable collection with a length. It can be of 8 * A [List] is an indexable collection with a length. It can be of
9 * fixed size or extendable. 9 * fixed size or extendable.
10 */ 10 */
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 void addLast(E value) { 297 void addLast(E value) {
298 throw new UnsupportedError( 298 throw new UnsupportedError(
299 "Cannot add to an unmodifiable list"); 299 "Cannot add to an unmodifiable list");
300 } 300 }
301 301
302 void addAll(Iterable<E> iterable) { 302 void addAll(Iterable<E> iterable) {
303 throw new UnsupportedError( 303 throw new UnsupportedError(
304 "Cannot add to an unmodifiable list"); 304 "Cannot add to an unmodifiable list");
305 } 305 }
306 306
307 void remove(E element) {
308 throw new UnsupportedError(
309 "Cannot remove from an unmodifiable list");
310 }
311
312 void removeAll(Iterable elements) {
313 throw new UnsupportedError(
314 "Cannot remove from an unmodifiable list");
315 }
316
317 void retainAll(Iterable elements) {
318 throw new UnsupportedError(
319 "Cannot remove from an unmodifiable list");
320 }
321
322 void removeMatching(bool test(E element)) {
323 throw new UnsupportedError(
324 "Cannot remove from an unmodifiable list");
325 }
326
307 void sort([Comparator<E> compare]) { 327 void sort([Comparator<E> compare]) {
308 throw new UnsupportedError( 328 throw new UnsupportedError(
309 "Cannot modify an unmodifiable list"); 329 "Cannot modify an unmodifiable list");
310 } 330 }
311 331
312 void clear() { 332 void clear() {
313 throw new UnsupportedError( 333 throw new UnsupportedError(
314 "Cannot clear an unmodifiable list"); 334 "Cannot clear an unmodifiable list");
315 } 335 }
316 336
317 E removeAt(int index) { 337 E removeAt(int index) {
318 throw new UnsupportedError( 338 throw new UnsupportedError(
319 "Cannot remove in an unmodifiable list"); 339 "Cannot remove from an unmodifiable list");
320 } 340 }
321 341
322 E removeLast() { 342 E removeLast() {
323 throw new UnsupportedError( 343 throw new UnsupportedError(
324 "Cannot remove in an unmodifiable list"); 344 "Cannot remove from an unmodifiable list");
325 } 345 }
326 346
327 void setRange(int start, int length, List<E> from, [int startFrom]) { 347 void setRange(int start, int length, List<E> from, [int startFrom]) {
328 throw new UnsupportedError( 348 throw new UnsupportedError(
329 "Cannot modify an unmodifiable list"); 349 "Cannot modify an unmodifiable list");
330 } 350 }
331 351
332 void removeRange(int start, int length) { 352 void removeRange(int start, int length) {
333 throw new UnsupportedError( 353 throw new UnsupportedError(
334 "Cannot remove in an unmodifiable list"); 354 "Cannot remove from an unmodifiable list");
335 } 355 }
336 356
337 void insertRange(int start, int length, [E initialValue]) { 357 void insertRange(int start, int length, [E initialValue]) {
338 throw new UnsupportedError( 358 throw new UnsupportedError(
339 "Cannot insert range in an unmodifiable list"); 359 "Cannot insert range in an unmodifiable list");
340 } 360 }
341 } 361 }
342 362
343 /** 363 /**
344 * Iterates over a [Sequence] in growing index order. 364 * Iterates over a [Sequence] in growing index order.
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 446
427 ListView<E> take(int takeCount) { 447 ListView<E> take(int takeCount) {
428 if (takeCount is! int || takeCount < 0) { 448 if (takeCount is! int || takeCount < 0) {
429 throw new ArgumentError(takeCount); 449 throw new ArgumentError(takeCount);
430 } 450 }
431 int newLength = takeCount; 451 int newLength = takeCount;
432 if (_length != null && takeCount > _length) newLength = _length; 452 if (_length != null && takeCount > _length) newLength = _length;
433 return new ListView(_list, _offset, newLength); 453 return new ListView(_list, _offset, newLength);
434 } 454 }
435 } 455 }
OLDNEW
« no previous file with comments | « sdk/lib/core/collection.dart ('k') | sdk/lib/core/queue.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698