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

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

Issue 12391073: Revert "Implement missing functions on ListBase." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 10 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
« no previous file with comments | « no previous file | tests/corelib/corelib.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_collection_dev/list.dart
diff --git a/sdk/lib/_collection_dev/list.dart b/sdk/lib/_collection_dev/list.dart
index 9685fda673a1ecf8d6ce2203af4342eb4bfce38b..cfb64994f28f25b1373c3c672889d2ccbcf1f0d3 100644
--- a/sdk/lib/_collection_dev/list.dart
+++ b/sdk/lib/_collection_dev/list.dart
@@ -24,35 +24,10 @@ abstract class ListBase<E> extends ListIterable<E> implements List<E> {
E elementAt(int index) {
return this[index];
}
-
Map<int, E> asMap() {
return new ListMapView(this);
}
- List<E> getRange(int start, int length) {
- if (start < 0 || start > this.length) {
- throw new RangeError.range(start, 0, this.length);
- }
- if (length < 0 || start + length > this.length) {
- throw new RangeError.range(length, 0, this.length - start);
- }
- List<E> result = new List<E>(length);
- for (int i = 0; i < length; i++) {
- result[i] = this[start + i];
- }
- return result;
- }
-
- int indexOf(E element, [int start = 0]) {
- return Arrays.indexOf(this, element, start, this.length);
- }
-
- int lastIndexOf(E element, [int start = null]) {
- if (start == null) start = length - 1;
- return Arrays.lastIndexOf(this, element, start);
- }
-
- Iterable<E> get reversed => new ReversedListIterable(this);
}
/**
@@ -115,11 +90,6 @@ abstract class FixedLengthListBase<E> extends ListBase<E> {
"Cannot remove from a fixed-length list");
}
- void retainMatching(bool test(E element)) {
- throw new UnsupportedError(
- "Cannot remove from a fixed-length list");
- }
-
void clear() {
throw new UnsupportedError(
"Cannot clear a fixed-length list");
@@ -196,11 +166,6 @@ abstract class UnmodifiableListBase<E> extends ListBase<E> {
"Cannot remove from an unmodifiable list");
}
- void retainMatching(bool test(E element)) {
- throw new UnsupportedError(
- "Cannot remove from an unmodifiable list");
- }
-
void sort([Comparator<E> compare]) {
throw new UnsupportedError(
"Cannot modify an unmodifiable list");
@@ -235,6 +200,20 @@ abstract class UnmodifiableListBase<E> extends ListBase<E> {
throw new UnsupportedError(
"Cannot insert range in an unmodifiable list");
}
+
+ List<E> getRange(int start, int length) {
+ if (start < 0 || start > this.length) {
+ throw new RangeError.range(start, 0, this.length);
+ }
+ if (length < 0 || start + length > this.length) {
+ throw new RangeError.range(length, 0, this.length - start);
+ }
+ List<E> result = new List<E>(length);
+ for (int i = 0; i < length; i++) {
+ result[i] = this[start + i];
+ }
+ return result;
+ }
}
/** An empty fixed-length list. */
« no previous file with comments | « no previous file | tests/corelib/corelib.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698