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

Unified Diff: sdk/lib/internal/iterable.dart

Issue 1815583002: Add generic annotations to more SDK APIs. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Remove generic type from _Future.then Created 4 years, 9 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/set.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/internal/iterable.dart
diff --git a/sdk/lib/internal/iterable.dart b/sdk/lib/internal/iterable.dart
index f3e316611ceea8b0d2912436114c534a7416cd11..7104c2767455a3d4e26f381171eaff80b392d56b 100644
--- a/sdk/lib/internal/iterable.dart
+++ b/sdk/lib/internal/iterable.dart
@@ -172,7 +172,8 @@ abstract class ListIterable<E> extends Iterable<E>
Iterable<E> where(bool test(E element)) => super.where(test);
- Iterable map(f(E element)) => new MappedListIterable(this, f);
+ Iterable/*<T>*/ map/*<T>*/(/*=T*/ f(E element)) =>
+ new MappedListIterable<E, dynamic/*=T*/ >(this, f);
E reduce(E combine(var value, E element)) {
int length = this.length;
@@ -188,7 +189,9 @@ abstract class ListIterable<E> extends Iterable<E>
return value;
}
- fold(var initialValue, combine(var previousValue, E element)) {
+ /*=T*/ fold/*<T>*/(
+ var/*=T*/ initialValue, /*=T*/ combine(
+ var/*=T*/ previousValue, E element)) {
var value = initialValue;
int length = this.length;
for (int i = 0; i < length; i++) {
@@ -555,7 +558,7 @@ class TakeWhileIterable<E> extends Iterable<E> {
class TakeWhileIterator<E> extends Iterator<E> {
final Iterator<E> _iterator;
- final _ElementPredicate _f;
+ final _ElementPredicate<E> _f;
bool _isFinished = false;
TakeWhileIterator(this._iterator, bool this._f(E element));
@@ -637,7 +640,7 @@ class SkipIterator<E> extends Iterator<E> {
class SkipWhileIterable<E> extends Iterable<E> {
final Iterable<E> _iterable;
- final _ElementPredicate _f;
+ final _ElementPredicate<E> _f;
SkipWhileIterable(this._iterable, bool this._f(E element));
@@ -648,7 +651,7 @@ class SkipWhileIterable<E> extends Iterable<E> {
class SkipWhileIterator<E> extends Iterator<E> {
final Iterator<E> _iterator;
- final _ElementPredicate _f;
+ final _ElementPredicate<E> _f;
bool _hasSkipped = false;
SkipWhileIterator(this._iterator, bool this._f(E element));
@@ -713,13 +716,15 @@ class EmptyIterable<E> extends Iterable<E> implements EfficientLength {
Iterable<E> where(bool test(E element)) => this;
- Iterable map(f(E element)) => const EmptyIterable();
+ Iterable/*<T>*/ map/*<T>*/(/*=T*/ f(E element)) => const EmptyIterable();
E reduce(E combine(E value, E element)) {
throw IterableElementError.noElement();
}
- fold(var initialValue, combine(var previousValue, E element)) {
+ /*=T*/ fold/*<T>*/(
+ var/*=T*/ initialValue, /*=T*/ combine(
+ var/*=T*/ previousValue, E element)) {
return initialValue;
}
@@ -737,9 +742,9 @@ class EmptyIterable<E> extends Iterable<E> implements EfficientLength {
Iterable<E> takeWhile(bool test(E element)) => this;
- List toList({ bool growable: true }) => growable ? <E>[] : new List<E>(0);
+ List<E> toList({bool growable: true}) => growable ? <E>[] : new List<E>(0);
- Set toSet() => new Set<E>();
+ Set<E> toSet() => new Set<E>();
}
/** The always empty iterator. */
« no previous file with comments | « sdk/lib/collection/set.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698