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

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

Issue 14246008: Allow Object when doing lookups. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Forgot to upload before committing Created 7 years, 6 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/linked_hash_map.dart ('k') | sdk/lib/collection/splay_tree.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 fa1bd5014aeca591ee179baaaf745ab8b666c492..5c81ae761efd5c7f9eceebfe1146765ae570ea22 100644
--- a/sdk/lib/collection/list.dart
+++ b/sdk/lib/collection/list.dart
@@ -63,7 +63,7 @@ abstract class ListMixin<E> implements List<E> {
return this[0];
}
- bool contains(E element) {
+ bool contains(Object element) {
int length = this.length;
for (int i = 0; i < length; i++) {
if (this[i] == element) return true;
@@ -96,7 +96,7 @@ abstract class ListMixin<E> implements List<E> {
return false;
}
- E firstWhere(bool test(E element), { E orElse() }) {
+ dynamic firstWhere(bool test(E element), { Object orElse() }) {
int length = this.length;
for (int i = 0; i < length; i++) {
E element = this[i];
@@ -109,7 +109,7 @@ abstract class ListMixin<E> implements List<E> {
throw new StateError("No matching element");
}
- E lastWhere(bool test(E element), { E orElse() }) {
+ dynamic lastWhere(bool test(E element), { Object orElse() }) {
int length = this.length;
for (int i = length - 1; i >= 0; i--) {
E element = this[i];
@@ -385,7 +385,7 @@ abstract class ListMixin<E> implements List<E> {
insertAll(start, newContents);
}
- int indexOf(E element, [int startIndex = 0]) {
+ int indexOf(Object element, [int startIndex = 0]) {
if (startIndex >= this.length) {
return -1;
}
@@ -405,7 +405,7 @@ abstract class ListMixin<E> implements List<E> {
* the search at index [startIndex] to 0.
* Returns -1 if [element] is not found.
*/
- int lastIndexOf(E element, [int startIndex]) {
+ int lastIndexOf(Object element, [int startIndex]) {
if (startIndex == null) {
startIndex = this.length - 1;
} else {
« no previous file with comments | « sdk/lib/collection/linked_hash_map.dart ('k') | sdk/lib/collection/splay_tree.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698