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

Unified Diff: lib/core/list.dart

Issue 10942025: Convert String and List to abstract classes. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated to tip-of-tree. Created 8 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: lib/core/list.dart
diff --git a/lib/core/list.dart b/lib/core/list.dart
index e44e743974677c650ce08f4dc1621155ec264c06..1262a6eb0e196d3218a7f06cbaf8353b74435791 100644
--- a/lib/core/list.dart
+++ b/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> default ListImplementation<E> {
-
+abstract class List<E> extends Collection<E> {
/**
* Creates a list of the given [length].
*
@@ -17,13 +16,19 @@ interface List<E> extends Collection<E> default ListImplementation<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) {
+ List<E> result = new List<E>();
+ for (E element in other) {
+ result.add(element);
+ }
+ return result;
+ }
/**
* Returns the element at the given [index] in the list or throws

Powered by Google App Engine
This is Rietveld 408576698