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

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: Addressed review comments 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 4daf8bb9543edb0a003bad6d6443165c5cafe4fb..db020ad7ca18e0ba3ef77b955d15bca014a94dec 100644
--- a/runtime/lib/growable_array.dart
+++ b/runtime/lib/growable_array.dart
@@ -108,15 +108,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