Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
55 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// 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(); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters