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

Unified Diff: runtime/lib/growable_array.dart

Issue 12817003: Change getRange to sublist. Make getRange deprecated. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 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/growable_array.dart
diff --git a/runtime/lib/growable_array.dart b/runtime/lib/growable_array.dart
index acad103af67063125985f446e2566c1402180b45..3ae8dd4a7bdcad2d4c79358aa04528198fb61947 100644
--- a/runtime/lib/growable_array.dart
+++ b/runtime/lib/growable_array.dart
@@ -86,15 +86,19 @@ class _GrowableObjectArray<T> implements List<T> {
}
}
- List<T> getRange(int start, int length) {
- if (length == 0) return [];
- Arrays.rangeCheck(this, start, length);
+ List<T> sublist(int start, [int end]) {
+ Arrays.indicesCheck(this, start, end);
+ if (end == null) end = length;
+ int length = end - start;
+ if (start == end) return <T>[];
List list = new _GrowableObjectArray<T>.withCapacity(length);
list.length = length;
Arrays.copy(this, start, list, 0, length);
return list;
}
+ List<T> getRange(int start, int length) => sublist(start, start + length);
+
factory _GrowableObjectArray(int length) {
var data = new _ObjectArray((length == 0) ? 4 : length);
var result = new _GrowableObjectArray<T>.withData(data);

Powered by Google App Engine
This is Rietveld 408576698