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

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

Issue 11777016: Fix some failures in html/element_test by changing where(...)[0] to where(...).first. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix type check on .where(...) from List to Iterable. 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 | « no previous file | tests/html/element_test.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 18 matching lines...) Expand all
29 * The length of the returned list is not fixed. 29 * The length of the returned list is not fixed.
30 */ 30 */
31 external factory List.filled(int length, E fill); 31 external factory List.filled(int length, E fill);
32 32
33 /** 33 /**
34 * Creates an list with the elements of [other]. The order in 34 * Creates an list with the elements of [other]. The order in
35 * the list will be the order provided by the iterator of [other]. 35 * the list will be the order provided by the iterator of [other].
36 * 36 *
37 * The length of the returned list is not fixed. 37 * The length of the returned list is not fixed.
38 */ 38 */
39 factory List.from(Iterable<E> other) { 39 factory List.from(Iterable other) {
40 var list = new List<E>(); 40 var list = new List<E>();
41 for (var e in other) { 41 for (var e in other) {
floitsch 2013/01/07 14:59:02 for (E e in other) {
42 list.add(e); 42 list.add(e);
43 } 43 }
44 return list; 44 return list;
45 } 45 }
46 46
47 /** 47 /**
48 * Returns the element at the given [index] in the list or throws 48 * Returns the element at the given [index] in the list or throws
49 * an [RangeError] if [index] is out of bounds. 49 * an [RangeError] if [index] is out of bounds.
50 */ 50 */
51 E operator [](int index); 51 E operator [](int index);
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 424
425 ListView<E> take(int takeCount) { 425 ListView<E> take(int takeCount) {
426 if (takeCount is! int || takeCount < 0) { 426 if (takeCount is! int || takeCount < 0) {
427 throw new ArgumentError(takeCount); 427 throw new ArgumentError(takeCount);
428 } 428 }
429 int newLength = takeCount; 429 int newLength = takeCount;
430 if (_length != null && takeCount > _length) newLength = _length; 430 if (_length != null && takeCount > _length) newLength = _length;
431 return new ListView(_list, _offset, newLength); 431 return new ListView(_list, _offset, newLength);
432 } 432 }
433 } 433 }
OLDNEW
« no previous file with comments | « no previous file | tests/html/element_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698