EmptySet<E> class

An empty set that doesn't allow adding-operations. Removing-operations (like remove, clear, retainWhere, ...) are ok, because the don't modify the contents of an empty set.

Inheritance

Constructors

EmptySet()
const

Properties

first → E
Throws a StateError; because there is no such element.
read-only, inherited
hashCode → int
The hash code for this object.
read-only, inherited
isEmpty → bool
Returns true if there are no elements in this collection. [...]
read-only, inherited
isNotEmpty → bool
Returns true if there is at least one element in this collection. [...]
read-only, inherited
iterator → Iterator<E>
Returns an empty iterator.
read-only, inherited
last → E
Throws a StateError; because there is no such element.
read-only, inherited
length → int
Returns 0.
read-only, inherited
runtimeType → Type
A representation of the runtime type of the object.
read-only, inherited
single → E
Throws a StateError; because there is no such element.
read-only, inherited

Methods

add(E value) → bool
Throws an UnsupportedError; operations that add to the collection are disallowed.
addAll(Iterable<E> elements) → void
Throws an UnsupportedError; operations that add to the collection are disallowed.
cast<R>() → Set<R>
returns itself because an empty Sets can switch its containee's type.
override
clear() → void
Empty set is already empty. Has no effect.
containsAll(Iterable<Object> other) → bool
Returns if true if other is empty, false otherwise.
difference(Set<Object> other) → Set<E>
Returns an empty set; there are no elements in this (empty) set that aren't in other.
intersection(Set<Object> other) → Set<E>
Returns an empty set; there are no elements in this (empty) set that are also in other.
lookup(Object element) → E
Returns always null; The empty set doesn't contain any elements and therefore returns null.
remove(Object element) → bool
Always returns false because the empty set didn't contain the element.
removeAll(Iterable<Object> elements) → void
Empty set is already empty. Has no effect.
removeWhere(bool test(E element)) → void
Empty set is already empty. Has no effect.
retainAll(Iterable<Object> elements) → void
Doesn't do anything; An optional remove on an empty set changes nothing.
retainWhere(bool test(E element)) → void
Does nothing. The empty set doesn't contain any elements and therefore can't remove one.
union(Set<E> other) → Set<E>
Returns a copy of other; union with an empty set leads to a copy.
any(bool f(E element)) → bool
Checks whether any element of this iterable satisfies test. [...]
inherited
contains(Object element) → bool
Returns true if the collection contains an element equal to element. [...]
inherited
elementAt(int index) → E
Throws a RangeError.
inherited
every(bool f(E element)) → bool
Returns true; because an empty iterable doesn't have an element for which the predicate could return false.
inherited
expand<T>(Iterable<T> f(E element)) → Iterable<T>
Returns itself; because this is already an empty iterable. So there is nothing to expand.
inherited
firstWhere(bool test(E element), { E orElse() }) → E
Returns the result of orElse if such a function is provided. Throws an StateError otherwise.
inherited
fold<T>(T initialValue, T combine(T previousValue, E element)) → T
Returns initialValue; because there is nothing to combine.
inherited
followedBy(Iterable<E> other) → Iterable<E>
Returns other; because this Iterator is empty.
inherited
forEach(void f(E element)) → void
Applies the function f to each element of this collection in iteration order.
inherited
join([String separator = "" ]) → String
Returns an empty string.
inherited
lastWhere(bool test(E element), { E orElse() }) → E
Returns the result of orElse if such a function is provided. Throws an StateError otherwise.
inherited
map<T>(T f(E e)) → Iterable<T>
Returns itself; because an empty iterable is an empty iterable and i can't create type information with a const constructor anyway.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
inherited
reduce(E combine(E value, E element)) → E
Throws a StateError; because there is no element available.
inherited
singleWhere(bool test(E element), { E orElse() }) → E
Throws a StateError; because there is no such element.
inherited
skip(int count) → Iterable<E>
Throws a RangeError if count is negative. Returns itself otherwise; because this is already an empty iterable.
inherited
skipWhile(bool test(E value)) → Iterable<E>
Returns itself; because this is already an empty iterable.
inherited
take(int count) → Iterable<E>
Throws a RangeError if count is negative. Returns itself otherwise; because this is already an empty iterable.
inherited
takeWhile(bool test(E value)) → Iterable<E>
Returns itself; because this is already an empty iterable.
inherited
toList({bool growable: true }) → List<E>
If growable is true (which is the default) new List.from(this, growable: true) is returned, otherwise an const EmptyList() which is more efficient than new List(0)
inherited
toSet() → Set<E>
The documentation says nothing about the behaviour of the resulting set, so an empty standard set is returned (new Set()) to which new elements can be added.
inherited
toString() → String
Returns a string representation of this object.
inherited
where(bool f(E element)) → Iterable<E>
Returns itself; because this is already an empty iterable.
inherited
whereType<T>() → Iterable<T>
Returns itself; because this is already an empty iterable.
inherited

Operators

operator ==(dynamic other) → bool
The equality operator.
inherited