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

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

Issue 14425003: Make List.remove return boolean. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/lib/js_array.dart ('k') | sdk/lib/collection/queue.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/collection/list.dart
diff --git a/sdk/lib/collection/list.dart b/sdk/lib/collection/list.dart
index ccde096f7b17c8bf642d4fa97bd33cd8c3052dda..a974552b755c6931aa0a6f70c9dbac885348a39f 100644
--- a/sdk/lib/collection/list.dart
+++ b/sdk/lib/collection/list.dart
@@ -242,14 +242,15 @@ abstract class ListMixin<E> implements List<E> {
}
}
- void remove(Object element) {
+ bool remove(Object element) {
for (int i = 0; i < this.length; i++) {
if (this[i] == element) {
- this.setRange(i, i + this.length - 1, this, i + 1);
+ this.setRange(i, this.length - 1, this, i + 1);
this.length -= 1;
- return;
+ return true;
}
}
+ return false;
}
void removeWhere(bool test(E element)) {
@@ -294,6 +295,7 @@ abstract class ListMixin<E> implements List<E> {
}
void sort([Comparator<E> compare]) {
+ if (compare == null) compare = Comparable.compare;
Sort.sort(this, compare);
}
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/lib/js_array.dart ('k') | sdk/lib/collection/queue.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698