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

Unified Diff: packages/collection/lib/src/empty_unmodifiable_set.dart

Issue 2989763002: Update charted to 0.4.8 and roll (Closed)
Patch Set: Removed Cutch from list of reviewers Created 3 years, 5 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 | « packages/collection/lib/src/comparators.dart ('k') | packages/collection/lib/src/equality.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: packages/collection/lib/src/empty_unmodifiable_set.dart
diff --git a/packages/collection/lib/src/empty_unmodifiable_set.dart b/packages/collection/lib/src/empty_unmodifiable_set.dart
new file mode 100644
index 0000000000000000000000000000000000000000..ea00959c027a66d0c950b1a190405521bad78f60
--- /dev/null
+++ b/packages/collection/lib/src/empty_unmodifiable_set.dart
@@ -0,0 +1,39 @@
+// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// 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.
+
+import 'dart:collection';
+
+import 'unmodifiable_wrappers.dart';
+
+// Unfortunately, we can't use UnmodifiableSetMixin here, since const classes
+// can't use mixins.
+/// An unmodifiable, empty set that can have a const constructor.
+class EmptyUnmodifiableSet<E> extends IterableBase<E>
+ implements UnmodifiableSetView<E> {
+ static T _throw<T>() {
+ throw new UnsupportedError("Cannot modify an unmodifiable Set");
+ }
+
+ Iterator<E> get iterator => new Iterable<E>.empty().iterator;
+ int get length => 0;
+
+ const EmptyUnmodifiableSet();
+
+ bool contains(Object element) => false;
+ bool containsAll(Iterable<Object> other) => other.isEmpty;
+ E lookup(Object element) => null;
+ Set<E> toSet() => new Set();
+ Set<E> union(Set<E> other) => new Set.from(other);
+ Set<E> intersection(Set<Object> other) => new Set();
+ Set<E> difference(Set<Object> other) => new Set();
+
+ bool add(E value) => _throw();
+ void addAll(Iterable<E> elements) => _throw();
+ void clear() => _throw();
+ bool remove(Object element) => _throw();
+ void removeAll(Iterable<Object> elements) => _throw();
+ void removeWhere(bool test(E element)) => _throw();
+ void retainWhere(bool test(E element)) => _throw();
+ void retainAll(Iterable<Object> elements) => _throw();
+}
« no previous file with comments | « packages/collection/lib/src/comparators.dart ('k') | packages/collection/lib/src/equality.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698