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

Unified Diff: sdk/lib/core/list.dart

Issue 11312122: Change List constructors. (Closed) Base URL: https://dart.googlecode.com/svn/experimental/lib_v2/dart
Patch Set: Address comments and fix. Created 8 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 side-by-side diff with in-line comments
Download patch
Index: sdk/lib/core/list.dart
diff --git a/sdk/lib/core/list.dart b/sdk/lib/core/list.dart
index b4948a3c1680aa616a39f6b605ea2363296015cb..1c5eafb9acfc5b53ab6245f3df322a7bfc3b79f3 100644
--- a/sdk/lib/core/list.dart
+++ b/sdk/lib/core/list.dart
@@ -9,18 +9,24 @@
interface List<E> extends Collection<E>, Sequence<E>
default _ListImpl<E> {
/**
- * Creates a list of the given [length].
- *
- * If no [length] argument is supplied an extendable list of
- * length 0 is created.
- *
- * If a [length] argument is supplied, a fixed size list of that
- * length is created.
+ * Creates an extendable list of the given [length].
sra1 2012/11/07 21:36:34 'extendable' is not quite right since it can be sh
floitsch 2012/11/12 13:21:50 reworded.
*/
- List([int length]);
+ List([int length = 0]);
/**
- * Creates a list with the elements of [other]. The order in
+ * Creates a fixed-sized list of the given [length] where each entry is
+ * filled with [fill].
+ */
+ List.fixedLength(int length, {E fill: null});
+
+ /**
+ * Creates an extendable list of the given [length] where each entry is
+ * filled with [fill].
+ */
+ List.filled(int length, E fill);
sra1 2012/11/07 21:36:34 It is a pity that 'fill' is a named parameter in o
floitsch 2012/11/12 13:21:50 Completely agree. There is bug open, but currently
+
+ /**
+ * Creates an extandable list with the elements of [other]. The order in
sra1 2012/11/07 21:36:34 extEndable, if you keep the name.
floitsch 2012/11/12 13:21:50 Reworded.
* the list will be the order provided by the iterator of [other].
*/
List.from(Iterable<E> other);
@@ -179,9 +185,21 @@ class _ListImpl<E> {
/**
* Factory implementation of List().
*
- * Creates a list of the given [length].
+ * Creates an extendable list of the given [length].
+ */
+ external factory List([int length = 0]);
+
+ /**
+ * Creates a fixed-sized list of the given [length] where each entry is
+ * filled with [fill].
+ */
+ external factory List.fixedLength(int length, {E fill: null});
+
+ /**
+ * Creates an extendable list of the given [length] where each entry is
+ * filled with [fill].
*/
- external factory List([int length]);
+ external factory List.filled(int length, E fill);
/**
* Factory implementation of List.from().

Powered by Google App Engine
This is Rietveld 408576698