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

Unified Diff: lib/src/iterable_zip.dart

Issue 1831103004: Fix strong mode warnings. (Closed) Base URL: git@github.com:dart-lang/collection@master
Patch Set: pubspec/changelog 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
Index: lib/src/iterable_zip.dart
diff --git a/lib/src/iterable_zip.dart b/lib/src/iterable_zip.dart
index 30acb0e72477600b6e44c5fc4dad522a37dc3c38..638c68673fff9727eeb39bd5c2858e63fe89eea8 100644
--- a/lib/src/iterable_zip.dart
+++ b/lib/src/iterable_zip.dart
@@ -13,24 +13,27 @@ import "dart:collection";
/// combined into a single list, which becomes the next value of this
/// [Iterable]'s [Iterator]. As soon as any of the iterators run out,
/// the zipped iterator also stops.
-class IterableZip extends IterableBase<List> {
- final Iterable<Iterable> _iterables;
- IterableZip(Iterable<Iterable> iterables)
+class IterableZip<T> extends IterableBase<List<T>> {
+ final Iterable<Iterable<T>> _iterables;
+
+ IterableZip(Iterable<Iterable<T>> iterables)
: this._iterables = iterables;
/// Returns an iterator that combines values of the iterables' iterators
/// as long as they all have values.
- Iterator<List> get iterator {
- List iterators = _iterables.map((x) => x.iterator).toList(growable: false);
+ Iterator<List<T>> get iterator {
+ var iterators = _iterables.map((x) => x.iterator).toList(growable: false);
// TODO(lrn): Return an empty iterator directly if iterators is empty?
- return new _IteratorZip(iterators);
+ return new _IteratorZip<T>(iterators);
}
}
-class _IteratorZip implements Iterator<List> {
- final List<Iterator> _iterators;
- List _current;
- _IteratorZip(List iterators) : _iterators = iterators;
+class _IteratorZip<T> implements Iterator<List<T>> {
+ final List<Iterator<T>> _iterators;
+ List<T> _current;
+
+ _IteratorZip(List<Iterator<T>> iterators) : _iterators = iterators;
+
bool moveNext() {
if (_iterators.isEmpty) return false;
for (int i = 0; i < _iterators.length; i++) {
@@ -46,5 +49,5 @@ class _IteratorZip implements Iterator<List> {
return true;
}
- List get current => _current;
+ List<T> get current => _current;
}

Powered by Google App Engine
This is Rietveld 408576698