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

Unified Diff: sdk/lib/collection/collections.dart

Issue 12386072: Move Arrays class to private library. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. 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 | « sdk/lib/collection/collection_sources.gypi ('k') | tests/language/list_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/collection/collections.dart
diff --git a/sdk/lib/collection/collections.dart b/sdk/lib/collection/collections.dart
index 949b69dfa0128442d93ee878aba2df1158da614b..6300b11dab077b2cdcdd73bf82f648b4b9854be7 100644
--- a/sdk/lib/collection/collections.dart
+++ b/sdk/lib/collection/collections.dart
@@ -347,13 +347,35 @@ class IterableMixinWorkaround {
return new SkipWhileIterable(iterable, test);
}
- static Iterable reversedList(List l) {
- return new ReversedListIterable(l);
+ static Iterable reversedList(List list) {
+ return new ReversedListIterable(list);
}
- static void sortList(List l, int compare(a, b)) {
+ static void sortList(List list, int compare(a, b)) {
if (compare == null) compare = Comparable.compare;
- Sort.sort(l, compare);
+ Sort.sort(list, compare);
+ }
+
+ static int indexOfList(List list, var element, int start) {
+ return Arrays.indexOf(list, element, start, list.length);
+ }
+
+ static int lastIndexOfList(List list, var element, int start) {
+ if (start == null) start = list.length - 1;
+ return Arrays.lastIndexOf(list, element, start);
+ }
+
+ static void setRangeList(List list, int start, int length,
+ List from, int startFrom) {
+ if (length == 0) return;
+
+ if (length < 0) throw new ArgumentError(length);
+ if (start < 0) throw new RangeError.value(start);
+ if (start + length > list.length) {
+ throw new RangeError.value(start + length);
+ }
+
+ Arrays.copy(from, startFrom, list, start, length);
}
static Map<int, dynamic> asMapList(List l) {
« no previous file with comments | « sdk/lib/collection/collection_sources.gypi ('k') | tests/language/list_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698