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

Unified Diff: runtime/lib/growable_array.dart

Issue 10905010: Some code cleanups in arrays, fix rangeCheck (issue 2899). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 4 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
« corelib/src/implementation/arrays.dart ('K') | « runtime/lib/array.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/growable_array.dart
===================================================================
--- runtime/lib/growable_array.dart (revision 11570)
+++ runtime/lib/growable_array.dart (working copy)
@@ -53,7 +53,7 @@
List<T> getRange(int start, int length) {
if (length == 0) return [];
Arrays.rangeCheck(this, start, length);
- List list = new List<T>();
+ List list = new GrowableObjectArray<T>.withCapacity(length);
list.length = length;
Arrays.copy(this, start, list, 0, length);
return list;
@@ -176,8 +176,7 @@
new GrowableObjectArray.withCapacity(length), f);
}
- Dynamic reduce(Dynamic initialValue,
- Dynamic combine(Dynamic previousValue, T element)) {
+ reduce(initialValue, combine(previousValue, T element)) {
return Collections.reduce(this, initialValue, combine);
}
« corelib/src/implementation/arrays.dart ('K') | « runtime/lib/array.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698