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

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

Issue 11417051: Make List an abstract class. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebase 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
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/lib/core_patch.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/core/list.dart
diff --git a/sdk/lib/core/list.dart b/sdk/lib/core/list.dart
index 8dc1577cf9420c1bc37126ff2346c0973776fbcb..43a98876e04705bd33bc520e26a5f16c45b147ec 100644
--- a/sdk/lib/core/list.dart
+++ b/sdk/lib/core/list.dart
@@ -6,8 +6,7 @@
* A [List] is an indexable collection with a length. It can be of
* fixed size or extendable.
*/
-interface List<E> extends Collection<E>, Sequence<E>
- default _ListImpl<E> {
+abstract class List<E> implements Collection<E>, Sequence<E> {
/**
* Creates a list of the given [length].
*
@@ -17,13 +16,19 @@ interface List<E> extends Collection<E>, Sequence<E>
* If a [length] argument is supplied, a fixed size list of that
* length is created.
*/
- List([int length]);
+ external factory List([int length]);
/**
* Creates a list with the elements of [other]. The order in
* the list will be the order provided by the iterator of [other].
*/
- List.from(Iterable<E> other);
+ factory List.from(Iterable<E> other) {
+ var list = new List<E>();
+ for (var e in other) {
+ list.add(e);
+ }
+ return list;
+ }
/**
* Returns the element at the given [index] in the list or throws
@@ -180,20 +185,3 @@ interface List<E> extends Collection<E>, Sequence<E>
*/
void insertRange(int start, int length, [E initialValue]);
}
-
-class _ListImpl<E> {
- /**
- * Factory implementation of List().
- *
- * Creates a list of the given [length].
- */
- external factory List([int length]);
-
- /**
- * Factory implementation of List.from().
- *
- * Creates a list with the elements of [other]. The order in
- * the list will be the order provided by the iterator of [other].
- */
- external factory List.from(Iterable<E> other);
-}
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/lib/core_patch.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698