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

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

Issue 1152483002: Add Iterable.empty constructor. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Address comments Created 5 years, 7 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 | « no previous file | sdk/lib/internal/iterable.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/core/iterable.dart
diff --git a/sdk/lib/core/iterable.dart b/sdk/lib/core/iterable.dart
index e435b1e7680786539216842297b416d9cc6541e1..c22283ab4e16da45383202539aa9494da16857f2 100644
--- a/sdk/lib/core/iterable.dart
+++ b/sdk/lib/core/iterable.dart
@@ -102,6 +102,17 @@ abstract class Iterable<E> {
}
/**
+ * Creates an empty iterable.
+ *
+ * The empty iterable has no elements, and iterating it always stops
+ * immediately.
+ *
+ * An empty iterable can be used in places where you always that
+ * the iterable you would otherwise create is empty.
+ */
+ const factory Iterable.empty() = EmptyIterable<E>;
+
+ /**
* Returns a new `Iterator` that allows iterating the elements of this
* `Iterable`.
*
« no previous file with comments | « no previous file | sdk/lib/internal/iterable.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698