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

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

Issue 2529393002: Make core libraries use generic method syntax. (Closed)
Patch Set: Merge to head Created 4 years 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
Index: sdk/lib/core/iterable.dart
diff --git a/sdk/lib/core/iterable.dart b/sdk/lib/core/iterable.dart
index 770465b37a44173eeddd975054f58405d13b4471..38e77afd576693bf40fa1941f10eb27287ad96fb 100644
--- a/sdk/lib/core/iterable.dart
+++ b/sdk/lib/core/iterable.dart
@@ -154,8 +154,8 @@ abstract class Iterable<E> {
* on any element where the result isn't needed.
* For example, [elementAt] may call `f` only once.
*/
- Iterable/*<T>*/ map/*<T>*/(/*=T*/ f(E e)) =>
- new MappedIterable<E, dynamic/*=T*/>(this, f);
+ Iterable<T> map<T>(T f(E e)) =>
+ new MappedIterable<E, T>(this, f);
/**
* Returns a new lazy [Iterable] with all elements that satisfy the
@@ -193,8 +193,8 @@ abstract class Iterable<E> {
* print(duplicated); // => [1, 1, 2, 2, 3, 3]
*
*/
- Iterable/*<T>*/ expand/*<T>*/(Iterable/*<T>*/ f(E element)) =>
- new ExpandIterable<E, dynamic/*=T*/>(this, f);
+ Iterable<T> expand<T>(Iterable<T> f(E element)) =>
+ new ExpandIterable<E, T>(this, f);
/**
* Returns true if the collection contains an element equal to [element].
@@ -280,8 +280,8 @@ abstract class Iterable<E> {
* iterable.fold(0, (prev, element) => prev + element);
*
*/
- dynamic/*=T*/ fold/*<T>*/(var/*=T*/ initialValue,
- dynamic/*=T*/ combine(var/*=T*/ previousValue, E element)) {
+ T fold<T>(T initialValue,
floitsch 2016/12/13 12:42:25 one line?
Lasse Reichstein Nielsen 2016/12/13 14:28:03 Done.
+ T combine(T previousValue, E element)) {
var value = initialValue;
for (E element in this) value = combine(value, element);
return value;

Powered by Google App Engine
This is Rietveld 408576698