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

Unified Diff: sdk/lib/collection/iterable.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/hash_set.dart ('k') | sdk/lib/collection/linked_hash_map.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/collection/iterable.dart
diff --git a/sdk/lib/collection/iterable.dart b/sdk/lib/collection/iterable.dart
index a9505432dd30f91ebfb62596764fd25fbc2ec4be..6dbf92ddf7926368a5cf3073b72d5c8974b72e06 100644
--- a/sdk/lib/collection/iterable.dart
+++ b/sdk/lib/collection/iterable.dart
@@ -17,7 +17,7 @@ abstract class IterableMixin<E> implements Iterable<E> {
Iterable expand(Iterable f(E element)) =>
new ExpandIterable<E, dynamic>(this, f);
- bool contains(E element) {
+ bool contains(Object element) {
for (E e in this) {
if (e == element) return true;
}
@@ -141,8 +141,7 @@ abstract class IterableMixin<E> implements Iterable<E> {
return result;
}
- E firstWhere(bool test(E value), { E orElse() }) {
- // TODO(floitsch): check that arguments are of correct type?
+ dynamic firstWhere(bool test(E value), { Object orElse() }) {
for (E element in this) {
if (test(element)) return element;
}
@@ -150,8 +149,7 @@ abstract class IterableMixin<E> implements Iterable<E> {
throw new StateError("No matching element");
}
- E lastWhere(bool test(E value), {E orElse()}) {
- // TODO(floitsch): check that arguments are of correct type?
+ dynamic lastWhere(bool test(E value), { Object orElse() }) {
E result = null;
bool foundMatching = false;
for (E element in this) {
@@ -166,7 +164,6 @@ abstract class IterableMixin<E> implements Iterable<E> {
}
E singleWhere(bool test(E value)) {
- // TODO(floitsch): check that argument is of correct type?
E result = null;
bool foundMatching = false;
for (E element in this) {
@@ -211,7 +208,7 @@ abstract class IterableBase<E> implements Iterable<E> {
Iterable expand(Iterable f(E element)) =>
new ExpandIterable<E, dynamic>(this, f);
- bool contains(E element) {
+ bool contains(Object element) {
for (E e in this) {
if (e == element) return true;
}
@@ -335,8 +332,7 @@ abstract class IterableBase<E> implements Iterable<E> {
return result;
}
- E firstWhere(bool test(E value), { E orElse() }) {
- // TODO(floitsch): check that arguments are of correct type?
+ dynamic firstWhere(bool test(E value), { Object orElse() }) {
for (E element in this) {
if (test(element)) return element;
}
@@ -344,8 +340,7 @@ abstract class IterableBase<E> implements Iterable<E> {
throw new StateError("No matching element");
}
- E lastWhere(bool test(E value), {E orElse()}) {
- // TODO(floitsch): check that arguments are of correct type?
+ dynamic lastWhere(bool test(E value), { Object orElse() }) {
E result = null;
bool foundMatching = false;
for (E element in this) {
@@ -360,7 +355,6 @@ abstract class IterableBase<E> implements Iterable<E> {
}
E singleWhere(bool test(E value)) {
- // TODO(floitsch): check that argument is of correct type?
E result = null;
bool foundMatching = false;
for (E element in this) {
« no previous file with comments | « sdk/lib/collection/hash_set.dart ('k') | sdk/lib/collection/linked_hash_map.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698