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

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

Issue 1440663003: Add "growable" parameter to List.filled constructor. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 1 month 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
« no previous file with comments | « sdk/lib/_internal/js_runtime/lib/core_patch.dart ('k') | tests/corelib/growable_list_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 * An indexable collection of objects with a length. 8 * An indexable collection of objects with a length.
9 * 9 *
10 * Subclasses of this class implement different kinds of lists. 10 * Subclasses of this class implement different kinds of lists.
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 * The [length] must not be negative or null, if it is provided. 75 * The [length] must not be negative or null, if it is provided.
76 */ 76 */
77 external factory List([int length]); 77 external factory List([int length]);
78 78
79 /** 79 /**
80 * Creates a fixed-length list of the given length, and initializes the 80 * Creates a fixed-length list of the given length, and initializes the
81 * value at each position with [fill]: 81 * value at each position with [fill]:
82 * 82 *
83 * new List<int>.filled(3, 0); // [0, 0, 0] 83 * new List<int>.filled(3, 0); // [0, 0, 0]
84 * 84 *
85 * The [length] must not be negative or null. 85 * The [length] must be a non-negative integer.
86 *
87 * If the list is growable, changing its length will not initialize new
88 * entries with [fill]. After being created and filled, the list is
89 * no different from any other growable or fixed-length list
90 * created using [List].
86 */ 91 */
87 external factory List.filled(int length, E fill); 92 external factory List.filled(int length, E fill, {bool growable: false});
88 93
89 /** 94 /**
90 * Creates a list containing all [elements]. 95 * Creates a list containing all [elements].
91 * 96 *
92 * The [Iterator] of [elements] provides the order of the elements. 97 * The [Iterator] of [elements] provides the order of the elements.
93 * 98 *
94 * This constructor returns a growable list when [growable] is true; 99 * This constructor returns a growable list when [growable] is true;
95 * otherwise, it returns a fixed-length list. 100 * otherwise, it returns a fixed-length list.
96 */ 101 */
97 external factory List.from(Iterable elements, { bool growable: true }); 102 external factory List.from(Iterable elements, { bool growable: true });
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 * as values. The `Map.keys` [Iterable] iterates the indices of this list 471 * as values. The `Map.keys` [Iterable] iterates the indices of this list
467 * in numerical order. 472 * in numerical order.
468 * 473 *
469 * List<String> words = ['fee', 'fi', 'fo', 'fum']; 474 * List<String> words = ['fee', 'fi', 'fo', 'fum'];
470 * Map<int, String> map = words.asMap(); 475 * Map<int, String> map = words.asMap();
471 * map[0] + map[1]; // 'feefi'; 476 * map[0] + map[1]; // 'feefi';
472 * map.keys.toList(); // [0, 1, 2, 3] 477 * map.keys.toList(); // [0, 1, 2, 3]
473 */ 478 */
474 Map<int, E> asMap(); 479 Map<int, E> asMap();
475 } 480 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/js_runtime/lib/core_patch.dart ('k') | tests/corelib/growable_list_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698