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

Unified Diff: lib/iterable_zip.dart

Issue 1638163002: Modernize the package's style. (Closed) Base URL: git@github.com:dart-lang/collection@master
Patch Set: Code review changes Created 4 years, 11 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 | « lib/equality.dart ('k') | lib/priority_queue.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/iterable_zip.dart
diff --git a/lib/iterable_zip.dart b/lib/iterable_zip.dart
index 772b07e66a4002a0565f4cfe9d22f1e8a1e8e7e7..34e18ef761fa345e4c59fa939848abfa82b813ca 100644
--- a/lib/iterable_zip.dart
+++ b/lib/iterable_zip.dart
@@ -2,58 +2,8 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-/**
- * Zipping multiple iterables into one iterable of tuples of values.
- */
+/// Import `collection.dart` instead.
+@Deprecated("Will be removed in collection 2.0.0.")
library dart.pkg.collection.iterable_zip;
-import "dart:collection" show IterableBase;
-
-/**
- * Iterable that iterates over lists of values from other iterables.
- *
- * When [iterator] is read, an [Iterator] is created for each [Iterable] in
- * the [Iterable] passed to the constructor.
- *
- * As long as all these iterators have a next value, those next values are
- * 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)
- : 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);
- // TODO(lrn): Return an empty iterator directly if iterators is empty?
- return new _IteratorZip(iterators);
- }
-}
-
-class _IteratorZip implements Iterator<List> {
- final List<Iterator> _iterators;
- List _current;
- _IteratorZip(List iterators) : _iterators = iterators;
- bool moveNext() {
- if (_iterators.isEmpty) return false;
- for (int i = 0; i < _iterators.length; i++) {
- if (!_iterators[i].moveNext()) {
- _current = null;
- return false;
- }
- }
- _current = new List(_iterators.length);
- for (int i = 0; i < _iterators.length; i++) {
- _current[i] = _iterators[i].current;
- }
- return true;
- }
-
- List get current => _current;
-}
+export "src/iterable_zip.dart";
« no previous file with comments | « lib/equality.dart ('k') | lib/priority_queue.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698