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

Unified Diff: runtime/lib/array.dart

Issue 14065011: Implement getRange (returning an Iterable). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 7 years, 8 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: runtime/lib/array.dart
diff --git a/runtime/lib/array.dart b/runtime/lib/array.dart
index 0f10ceb2b541e9a3cbb45015e3080469044183fb..a4182b8f7c019f413a6abffa99f0304fcc0f89e0 100644
--- a/runtime/lib/array.dart
+++ b/runtime/lib/array.dart
@@ -60,6 +60,10 @@ class _ObjectArray<E> implements List<E> {
"Cannot remove element of a non-extendable array");
}
+ Iterable<E> getRange(int start, [int end]) {
+ return IterableMixinWorkaround.getRangeList(this, start, end);
+ }
+
// List interface.
void setRange(int start, int length, List<E> from, [int startFrom = 0]) {
if (length < 0) {
@@ -94,8 +98,6 @@ class _ObjectArray<E> implements List<E> {
return list;
}
- List<E> getRange(int start, int length) => sublist(start, start + length);
-
// Iterable interface.
bool contains(E element) {
@@ -337,7 +339,9 @@ class _ImmutableArray<E> implements List<E> {
return list;
}
- List<E> getRange(int start, int length) => sublist(start, start + length);
+ Iterable<E> getRange(int start, int end) {
+ return IterableMixinWorkaround.getRangeList(this, start, end);
+ }
// Collection interface.
« no previous file with comments | « editor/util/plugins/com.google.dart.java2dart/resources/java_core.dart ('k') | runtime/lib/growable_array.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698